diff --git a/src/main/java/mvp/deplog/domain/auth/application/AuthServiceImpl.java b/src/main/java/mvp/deplog/domain/auth/application/AuthServiceImpl.java index 9ea7139..e04a596 100644 --- a/src/main/java/mvp/deplog/domain/auth/application/AuthServiceImpl.java +++ b/src/main/java/mvp/deplog/domain/auth/application/AuthServiceImpl.java @@ -200,6 +200,12 @@ public SuccessResponse exit(UserDetailsImpl userDetails) { } } commentRepository.deleteAll(postCommentList); + + List postLikes = likesRepository.findByPost(post); + likesRepository.deleteAll(postLikes); + + List postScraps = scrapRepository.findByPost(post); + scrapRepository.deleteAll(postScraps); } postRepository.deleteAll(postList); diff --git a/src/main/java/mvp/deplog/domain/likes/domain/repository/LikesRepository.java b/src/main/java/mvp/deplog/domain/likes/domain/repository/LikesRepository.java index 690cb06..d76c02e 100644 --- a/src/main/java/mvp/deplog/domain/likes/domain/repository/LikesRepository.java +++ b/src/main/java/mvp/deplog/domain/likes/domain/repository/LikesRepository.java @@ -17,4 +17,6 @@ public interface LikesRepository extends JpaRepository { List findAllByMember(Member member); void deleteByPost(Post post); + + List findByPost(Post post); } diff --git a/src/main/java/mvp/deplog/domain/scrap/domain/repository/ScrapRepository.java b/src/main/java/mvp/deplog/domain/scrap/domain/repository/ScrapRepository.java index b9f4e0d..150c9e7 100644 --- a/src/main/java/mvp/deplog/domain/scrap/domain/repository/ScrapRepository.java +++ b/src/main/java/mvp/deplog/domain/scrap/domain/repository/ScrapRepository.java @@ -21,4 +21,6 @@ public interface ScrapRepository extends JpaRepository { List findAllByMember(Member member); void deleteByPost(Post post); + + List findByPost(Post post); }