Skip to content

Commit

Permalink
[FIX] 유저가 2번 생성되는 경우 임시 대응
Browse files Browse the repository at this point in the history
  • Loading branch information
ddongseop committed Dec 11, 2023
1 parent 8dc2c7c commit 199abde
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<User> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public interface UserRepository extends Repository<User, Long> {
// READ
Optional<User> findById(Long id);
boolean existsBySocialPlatformAndSocialId(SocialPlatform socialPlatform, String socialId);
Optional<User> findBySocialPlatformAndSocialId(SocialPlatform socialPlatform, String socialId);
List<User> findBySocialPlatformAndSocialId(SocialPlatform socialPlatform, String socialId);
Optional<User> findByFcmToken(String fcmToken);

// DELETE
Expand Down

0 comments on commit 199abde

Please sign in to comment.