From 9b1361d65dba285e51d496c8817adaeda15a8ab9 Mon Sep 17 00:00:00 2001 From: tkdwns414 Date: Tue, 5 Mar 2024 10:10:23 +0900 Subject: [PATCH] [fix] fix clear to deleteAll (wrong logic) --- .../java/org/pingle/pingleserver/service/UserService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/pingle/pingleserver/service/UserService.java b/src/main/java/org/pingle/pingleserver/service/UserService.java index 4700f73..dd2e9c2 100644 --- a/src/main/java/org/pingle/pingleserver/service/UserService.java +++ b/src/main/java/org/pingle/pingleserver/service/UserService.java @@ -14,6 +14,7 @@ import org.pingle.pingleserver.repository.MeetingRepository; import org.pingle.pingleserver.repository.UserMeetingRepository; import org.pingle.pingleserver.repository.UserRepository; +import org.pingle.pingleserver.repository.UserTeamRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -29,6 +30,7 @@ public class UserService { private final AppleLoginService appleLoginService; private final MeetingRepository meetingRepository; private final UserMeetingRepository userMeetingRepository; + private final UserTeamRepository userTeamRepository; public UserInfoResponse getUserInfo(Long userId) { User user = userRepository.findByIdAndIsDeletedOrThrow(userId, false); @@ -58,7 +60,7 @@ private void leaveGroups (User user){ if (hasAdminRole) { throw new CustomException(ErrorMessage.GROUP_OWNER_DELETION_DENIED); } - user.getUserTeams().clear(); + userTeamRepository.deleteAll(user.getUserTeams()); } private void leaveMeetings (User user){