Skip to content

Commit

Permalink
Merge pull request #83 from Murakano/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jjikky authored Jul 21, 2024
2 parents 0c455e2 + a480611 commit 555d851
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/routes/user/user.repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 555d851

Please sign in to comment.