Skip to content

Commit

Permalink
Merge pull request #149 from TeamDon-tBe/feat/#148
Browse files Browse the repository at this point in the history
  • Loading branch information
bo-ram-bo-ram authored Feb 19, 2024
2 parents 1e60e1a + 552fb39 commit 4d16680
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ default Comment findCommentByIdOrThrow(Long commentId) {
return findCommentById(commentId)
.orElseThrow(() -> new NotFoundException(ErrorStatus.NOT_FOUND_COMMENT.getMessage()));
}

void deleteCommentsByMemberId(Long memberId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ public void deleteContent(Long memberId, Long contentId) {
List<Comment> comments = commentRepository.findCommentsByContentId(contentId);
for(Comment comment : comments) {
notificationRepository.deleteByNotificationTriggerTypeAndNotificationTriggerId("commentLiked",comment.getId());
// notificationRepository.deleteByNotificationTriggerTypeAndNotificationTriggerId("commentGhost",comment.getId()); //변경 후 다시 바꾸기
//notificationRepository.deleteByNotificationTriggerTypeAndNotificationTriggerId("commentGhost",comment.getId()); //변경 후 다시 바꾸기
notificationRepository.deleteByNotificationTriggerTypeAndNotificationTriggerId("commentGhost",contentId);
notificationRepository.deleteByNotificationTriggerTypeAndNotificationTriggerId("comment", comment.getId());
commentLikedRepository.deleteByComment(comment);
commentRepository.deleteById(comment.getId());
}
notificationRepository.deleteByNotificationTriggerTypeAndNotificationTriggerId("contentLiked",contentId);
notificationRepository.deleteByNotificationTriggerTypeAndNotificationTriggerId("contentGhost",contentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void testWithdrawalMember(Long memberId){
List<Ghost> ghostList1 = ghostRepository.findByGhostTargetMember(member);
List<Ghost> ghostList2 = ghostRepository.findByGhostTriggerMember(member);

//게시글들 안에서 각 게시글에 대한 답글들의 좋아요 노티, 투명도 노티, 답글 노티, 답글 삭제 + 게시글 좋아요 삭제, 게시글 투명도 삭제, 게시글 삭제(소프트 딜리트 X)
//게시글들 안에서 각 게시글에 대한 답글들의 좋아요 노티, 투명도 노티, 답글 노티, 게시글 투명도 삭제, 게시글 삭제(소프트 딜리트 X)
for(Content content : contentList) {
Long contentId = content.getId();
List<Comment> comments = commentRepository.findCommentsByContentId(contentId);
Expand All @@ -49,8 +49,6 @@ public void testWithdrawalMember(Long memberId){
// notificationRepository.deleteByNotificationTriggerTypeAndNotificationTriggerId("commentGhost",comment.getId()); //변경 후 다시 바꾸기
notificationRepository.deleteByNotificationTriggerTypeAndNotificationTriggerId("commentGhost",contentId);
notificationRepository.deleteByNotificationTriggerTypeAndNotificationTriggerId("comment", comment.getId());
commentLikedRepository.deleteByComment(comment);
commentRepository.deleteById(comment.getId());
}
notificationRepository.deleteByNotificationTriggerTypeAndNotificationTriggerId("contentLiked",contentId);
notificationRepository.deleteByNotificationTriggerTypeAndNotificationTriggerId("contentGhost",contentId);
Expand All @@ -69,7 +67,10 @@ public void testWithdrawalMember(Long memberId){
//이대로 진행할 경우 어떤 유저는 평생 default값이 -1일 수도ㅜㅜ
ghostRepository.deleteAll(ghostList1);
ghostRepository.deleteAll(ghostList2);
// contentRepository.deleteAll(contentList);

//탈퇴하는 유저가 작성한 답글 삭제
commentRepository.deleteCommentsByMemberId(memberId);

memberRepository.delete(member);
}

Expand Down

0 comments on commit 4d16680

Please sign in to comment.