Skip to content

Commit 3eb7607

Browse files
committed
♻️ refactor: 댓글 업데이트 find 2번 수행 -\> 1번 수행 변경
1 parent fa71d6a commit 3eb7607

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

server/src/comment/service/comment.service.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export class CommentService {
3838
if (userInformation.id !== commentObj.user.id) {
3939
throw new UnauthorizedException('본인이 작성한 댓글이 아닙니다.');
4040
}
41+
42+
return commentObj;
4143
}
4244

4345
async get(commentDto: GetCommentRequestDto) {
@@ -68,11 +70,10 @@ export class CommentService {
6870
}
6971

7072
async update(userInformation: Payload, commentDto: UpdateCommentRequestDto) {
71-
await this.commentCheck(userInformation, commentDto.commentId);
72-
const commentObj = await this.commentRepository.findOneBy({
73-
id: commentDto.commentId,
74-
});
75-
73+
const commentObj = await this.commentCheck(
74+
userInformation,
75+
commentDto.commentId,
76+
);
7677
commentObj.comment = commentDto.newComment;
7778
await this.commentRepository.save(commentObj);
7879
}

0 commit comments

Comments
 (0)