Skip to content

Commit d17592f

Browse files
committed
refactor: 삭제 메서드로 사용자 연관 데이터를 삭제하도록
1 parent 46df0f3 commit d17592f

File tree

17 files changed

+100
-90
lines changed

17 files changed

+100
-90
lines changed

src/main/java/com/example/solidconnection/application/repository/ApplicationRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@ default Application getApplicationBySiteUserIdAndTermId(long siteUserId, long te
4040
return findBySiteUserIdAndTermId(siteUserId, termId)
4141
.orElseThrow(() -> new CustomException(APPLICATION_NOT_FOUND));
4242
}
43+
44+
void deleteAllBySiteUserId(long siteUserId);
4345
}

src/main/java/com/example/solidconnection/chat/repository/ChatParticipantRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ public interface ChatParticipantRepository extends JpaRepository<ChatParticipant
99
boolean existsByChatRoomIdAndSiteUserId(long chatRoomId, long siteUserId);
1010

1111
Optional<ChatParticipant> findByChatRoomIdAndSiteUserId(long chatRoomId, long siteUserId);
12+
13+
void deleteAllBySiteUserId(long siteUserId);
1214
}

src/main/java/com/example/solidconnection/community/comment/repository/CommentRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@ default Comment getById(Long id) {
4242
return findById(id)
4343
.orElseThrow(() -> new CustomException(INVALID_COMMENT_ID));
4444
}
45+
46+
void deleteAllBySiteUserId(long siteUserId);
4547
}

src/main/java/com/example/solidconnection/community/post/repository/PostLikeRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ default PostLike getByPostAndSiteUserId(Post post, long siteUserId) {
1616
return findPostLikeByPostAndSiteUserId(post, siteUserId)
1717
.orElseThrow(() -> new CustomException(INVALID_POST_LIKE));
1818
}
19+
20+
void deleteAllBySiteUserId(long siteUserId);
1921
}

src/main/java/com/example/solidconnection/community/post/repository/PostRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,6 @@ default Post getById(Long id) {
5959
return findById(id)
6060
.orElseThrow(() -> new CustomException(INVALID_POST_ID));
6161
}
62+
63+
void deleteAllBySiteUserId(long siteUserId);
6264
}

src/main/java/com/example/solidconnection/mentor/repository/MentorApplicationRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
public interface MentorApplicationRepository extends JpaRepository<MentorApplication, Long> {
99

1010
boolean existsBySiteUserIdAndMentorApplicationStatusIn(long siteUserId, List<MentorApplicationStatus> mentorApplicationStatuses);
11+
12+
void deleteAllBySiteUserId(long siteUserId);
1113
}

src/main/java/com/example/solidconnection/mentor/repository/MentorRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ public interface MentorRepository extends JpaRepository<Mentor, Long> {
2727
Slice<Mentor> findAllByRegion(@Param("region") Region region, Pageable pageable);
2828

2929
List<Mentor> findAllBySiteUserIdIn(Set<Long> siteUserIds);
30+
31+
void deleteBySiteUserId(long siteUserId);
3032
}

src/main/java/com/example/solidconnection/mentor/repository/MentoringRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,6 @@ public interface MentoringRepository extends JpaRepository<Mentoring, Long> {
3939

4040
@Query("SELECT m FROM Mentoring m WHERE m.menteeId = :menteeId AND m.verifyStatus = :verifyStatus")
4141
Slice<Mentoring> findApprovedMentoringsByMenteeId(long menteeId, @Param("verifyStatus") VerifyStatus verifyStatus, Pageable pageable);
42+
43+
void deleteAllByMenteeId(long menteeId);
4244
}

src/main/java/com/example/solidconnection/news/repository/LikedNewsRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ public interface LikedNewsRepository extends JpaRepository<LikedNews, Long> {
99
boolean existsByNewsIdAndSiteUserId(long newsId, long siteUserId);
1010

1111
Optional<LikedNews> findByNewsIdAndSiteUserId(long newsId, long siteUserId);
12+
13+
void deleteAllBySiteUserId(long siteUserId);
1214
}

src/main/java/com/example/solidconnection/news/repository/NewsRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
public interface NewsRepository extends JpaRepository<News, Long>, NewsCustomRepository {
99

1010
List<News> findAllBySiteUserIdOrderByUpdatedAtDesc(long siteUserId);
11+
12+
void deleteAllBySiteUserId(long siteUserId);
1113
}

0 commit comments

Comments
 (0)