diff --git a/backend/src/main/java/hanglog/login/service/LoginService.java b/backend/src/main/java/hanglog/login/service/LoginService.java index 388108183..5996320db 100644 --- a/backend/src/main/java/hanglog/login/service/LoginService.java +++ b/backend/src/main/java/hanglog/login/service/LoginService.java @@ -98,9 +98,13 @@ public void removeRefreshToken(final String refreshToken) { public void deleteAccount(final Long memberId) { final List tripIds = customTripRepository.findTripIdsByMemberId(memberId); - publishedTripRepository.deleteByTripIds(tripIds); - sharedTripRepository.deleteByTripIds(tripIds); + + if (!tripIds.isEmpty()) { + publishedTripRepository.deleteByTripIds(tripIds); + sharedTripRepository.deleteByTripIds(tripIds); + publisher.publishEvent(new MemberDeleteEvent(tripIds, memberId)); + } + memberRepository.deleteByMemberId(memberId); - publisher.publishEvent(new MemberDeleteEvent(tripIds, memberId)); } }