Skip to content

Commit

Permalink
✅ 유저 삭제 cascade 구현 완료, 난 JPA가 싫다
Browse files Browse the repository at this point in the history
  • Loading branch information
tjdals4716 committed Nov 1, 2024
1 parent 84f015b commit dbbce50
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
public interface BucketRepository extends JpaRepository <BucketlistEntity, Long> {
List<BucketlistEntity> findByUser_Uid(String uid);
List<BucketlistEntity> findByTitleContainingIgnoreCaseOrContentContainingIgnoreCase(String title, String content);
void deleteByUser_Uid(String uid);
void deleteByUserUid(String uid);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public interface MessageRepository extends JpaRepository<MessageEntity, Long> {
List<MessageEntity> findBySenderUid(String senderId);
List<MessageEntity> findByReceiverUid(String receiverId);
List<MessageEntity> findByContentContainingIgnoreCase(String keyword);
void deleteByBucketListId(Long bucketListId);
void deleteBySenderUid(String uid);
void deleteByReceiverUid(String uid);
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public UserDTO deleteUser(String uid, UserDetails userDetails) {
if (userEntity == null) {
throw new RuntimeException("해당 유저가 존재하지 않습니다.");
}
bucketRepository.deleteByUser_Uid(uid);
bucketRepository.deleteByUserUid(uid);
messageRepository.deleteBySenderUid(uid);
messageRepository.deleteByReceiverUid(uid);
userRepository.delete(userEntity);
Expand Down

0 comments on commit dbbce50

Please sign in to comment.