diff --git a/umbba-api/src/main/java/sopt/org/umbba/api/service/user/AuthService.java b/umbba-api/src/main/java/sopt/org/umbba/api/service/user/AuthService.java index cd3923f8..e72c3164 100644 --- a/umbba-api/src/main/java/sopt/org/umbba/api/service/user/AuthService.java +++ b/umbba-api/src/main/java/sopt/org/umbba/api/service/user/AuthService.java @@ -131,8 +131,12 @@ private User getUserById(Long userId) { } private User getUserBySocialAndSocialId(SocialPlatform socialPlatform, String socialId) { - return userRepository.findBySocialPlatformAndSocialId(socialPlatform, socialId) - .orElseThrow(() -> new CustomException(ErrorType.INVALID_USER)); + List users = userRepository.findBySocialPlatformAndSocialId(socialPlatform, socialId); + if (users.isEmpty()) { + throw new CustomException(ErrorType.INVALID_USER); + } + + return users.get(0); } private boolean isUserBySocialAndSocialId(SocialPlatform socialPlatform, String socialId) { diff --git a/umbba-domain/src/main/java/sopt/org/umbba/domain/domain/user/repository/UserRepository.java b/umbba-domain/src/main/java/sopt/org/umbba/domain/domain/user/repository/UserRepository.java index 5e717518..c4935cc2 100644 --- a/umbba-domain/src/main/java/sopt/org/umbba/domain/domain/user/repository/UserRepository.java +++ b/umbba-domain/src/main/java/sopt/org/umbba/domain/domain/user/repository/UserRepository.java @@ -16,7 +16,7 @@ public interface UserRepository extends Repository { // READ Optional findById(Long id); boolean existsBySocialPlatformAndSocialId(SocialPlatform socialPlatform, String socialId); - Optional findBySocialPlatformAndSocialId(SocialPlatform socialPlatform, String socialId); + List findBySocialPlatformAndSocialId(SocialPlatform socialPlatform, String socialId); Optional findByFcmToken(String fcmToken); // DELETE