Skip to content

Commit e760682

Browse files
committed
CLAP-324 Fix: git conflict solve
1 parent 0f2236b commit e760682

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/main/java/clap/server/application/service/history/CommandCommentService.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import clap.server.exception.DomainException;
1919
import clap.server.exception.code.CommentErrorCode;
2020
import clap.server.exception.code.MemberErrorCode;
21+
import clap.server.exception.code.TaskErrorCode;
2122
import lombok.RequiredArgsConstructor;
2223
import lombok.extern.slf4j.Slf4j;
2324
import org.springframework.transaction.annotation.Transactional;
@@ -35,34 +36,34 @@ public class CommandCommentService implements EditCommentUsecase, DeleteCommentU
3536
private final CommandCommentPort commandCommentPort;
3637
private final LoadAttachmentPort loadAttachmentPort;
3738
private final CommandAttachmentPort commandAttachmentPort;
38-
private final CommandTaskHistoryPort commandTaskHistoryPort;
3939

4040
@Transactional
4141
@Override
42-
public void editComment(Long userId, Long commentId, EditCommentRequest request) {
43-
Member member = memberService.findActiveMember(userId);
42+
public void editComment(Long memberId, Long commentId, EditCommentRequest request) {
43+
Member member = memberService.findActiveMember(memberId);
4444
Comment comment = commentService.findById(commentId);
4545

46-
if (Member.checkCommenter(comment.getTask(), member)) {
46+
if (comment.getMember().getMemberId().equals(member.getMemberId())) {
4747
comment.updateComment(request.content());
4848
commandCommentPort.saveComment(comment);
49-
};
49+
}
50+
else throw new ApplicationException(CommentErrorCode.NOT_A_COMMENT_WRITER);
51+
5052
}
5153

5254
@Transactional
5355
@Override
54-
public void deleteComment(Long userId, Long commentId) {
55-
Member member = memberService.findActiveMember(userId);
56+
public void deleteComment(Long memberId, Long commentId) {
57+
Member member = memberService.findActiveMember(memberId);
5658
Comment comment = commentService.findById(commentId);
57-
58-
59-
if (Objects.equals(comment.getMember().getMemberId(), member.getMemberId())) {
59+
60+
if (comment.getMember().getMemberId().equals(member.getMemberId())) {
6061
if (loadAttachmentPort.exitsByCommentId(commentId)) {
6162
deleteAttachments(commentId);
6263
}
6364
commandCommentPort.deleteCommentWithTaskHistory(commentId);
6465
}else{
65-
throw new DomainException(MemberErrorCode.NOT_A_COMMENTER);
66+
throw new ApplicationException(CommentErrorCode.NOT_A_COMMENT_WRITER);
6667
}
6768
}
6869

0 commit comments

Comments
 (0)