Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
@Getter
@SuperBuilder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SQLDelete(sql = "UPDATE comment SET is_deleted = true WHERE comment_id = ?")
@SQLRestriction("is_deleted = false")
public class CommentEntity extends BaseTimeEntity {
@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@Repository
public interface TaskHistoryRepository extends JpaRepository<TaskHistoryEntity, Long>, TaskHistoryCustomRepository {
@Modifying
@Modifying(clearAutomatically = true, flushAutomatically = true)
@Query("UPDATE TaskHistoryEntity t SET t.isDeleted = true WHERE t.comment.commentId = :commentId")
void updateByComment_CommentId(@Param("commentId") Long commentId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,14 @@ public void deleteComment(Long userId, Long commentId) {
Member member = memberService.findActiveMember(userId);
Comment comment = commentService.findById(commentId);

if (Member.checkCommenter(comment.getTask(), member)) {
// 첨부파일이 있을 경우 삭제

if (Objects.equals(comment.getMember().getMemberId(), member.getMemberId())) {
if (loadAttachmentPort.exitsByCommentId(commentId)) {
deleteAttachments(commentId);
}
// comment 삭제
commandCommentPort.deleteComment(comment);
// comment와 관련된 taskHistory도 함께 삭제

commandTaskHistoryPort.deleteTaskHistoryByCommentId(commentId);
commandCommentPort.deleteCommentWithTaskHistory(commentId);
}else{
throw new DomainException(MemberErrorCode.NOT_A_COMMENTER);
}
}

Expand Down