From 1b26ba4c6ca538a5e58676b037b3ad88f9ce14b5 Mon Sep 17 00:00:00 2001 From: jjikky Date: Sun, 21 Jul 2024 23:07:20 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=EC=88=98=EC=A0=95=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20=EC=9A=94=EC=B2=AD=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/user/user.repository.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/routes/user/user.repository.js b/src/routes/user/user.repository.js index 517be33..32d2627 100644 --- a/src/routes/user/user.repository.js +++ b/src/routes/user/user.repository.js @@ -92,14 +92,11 @@ exports.postWords = async (userId, formData, nickname, type) => { throw new Error('User not found'); } - console.log('User before modification:', JSON.stringify(user.requests, null, 2)); - // 이미 존재하는 단어 요청 확인 (status가 'pend'인 경우에만 중복 확인) const existingRequest = user.requests.find( - (req) => req.word === formData.devTerm && req.status === 'pend' && req.deletedAt === 'null' + (req) => req.word === formData.devTerm && req.status === 'pend' && req.deletedAt === null ); if (existingRequest) { - console.log('이미 같은 단어 요청이 존재합니다.'); throw new Error('Word request already exists'); } @@ -130,7 +127,7 @@ exports.postWords = async (userId, formData, nickname, type) => { } await user.save(); - console.log('User after modification:', JSON.stringify(user.requests, null, 2)); + return user.requests.find((req) => req.word === formData.devTerm); } catch (err) { console.error(err);