Skip to content

Commit

Permalink
feat: user 성향 검사 검증 (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
gardening-y committed Jan 9, 2024
1 parent f298d32 commit f362767
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public UserResponse signIn(String token, UserSignInRequest request) {
User findUser = getUser(enumPlatform, platformId);
Token issueToken = jwtProvider.issueToken(findUser.getId());
updateRefreshToken(issueToken.refreshToken(), findUser);
validateResult(findUser);

return UserResponse.of(issueToken);
}
Expand Down Expand Up @@ -107,6 +108,12 @@ private void updateRefreshToken(String refreshToken, User user) {
refreshTokenRepository.save(RefreshToken.createRefreshToken(user.getId(), refreshToken));
}

private void validateResult(User user) {
if (user.getResult() == null) {
throw new EntityNotFoundException(ErrorMessage.RESULT_NOT_FOUND);
}
}

private User saveUser(UserSignUpRequest request, String platformId, Platform enumPlatform) {
User user = createUser(request.name(), request.intro(), platformId, enumPlatform);
return userRepository.save(user);
Expand Down

0 comments on commit f362767

Please sign in to comment.