Skip to content

Commit

Permalink
Merge pull request #157 from YogitTeam/feat/user-profile
Browse files Browse the repository at this point in the history
#8 refactor : 애플 회원가입시, 애플 서버에서 받은 유저 이름 사용하지 않고 null로 저장
  • Loading branch information
shinhn authored Mar 24, 2023
2 parents 5a0c044 + 7343334 commit 1f13984
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ public TokenResponse requestCodeValidations(ServicesResponse serviceResponse, St
String email = user.getAsString("email");

// 이름 추출
Map<String, String> name = (Map<String, String>) user.get("name");
String lastName = name.get("lastName");
String firstName = name.get("firstName");
String fullName = lastName + firstName;
// Map<String, String> name = (Map<String, String>) user.get("name");
// String lastName = name.get("lastName");
// String firstName = name.get("firstName");
// String fullName = lastName + firstName;

// 만약 처음 인증하는 유저여서 refresh 토큰 없으면 client_secret, authorization_code로 검증
if (client_secret != null && code != null && refresh_token == null) {
tokenResponse = appleUtils.validateAuthorizationGrantCode(client_secret, code);

// 유저 생성
CreateUserAppleReq createUserAppleReq = new CreateUserAppleReq(email, tokenResponse.getRefresh_token(),fullName, UserType.APPLE);
CreateUserAppleReq createUserAppleReq = new CreateUserAppleReq(email, tokenResponse.getRefresh_token(),null, UserType.APPLE);
saveduser = userService.createUserApple(createUserAppleReq);
}
// 이미 refresh 토큰 있는 유저면 client_secret, refresh_token로 검증
Expand Down Expand Up @@ -169,7 +169,10 @@ public void deleteUser(DeleteUserReq deleteUserReq) {

// 유저 정보 삭제 및 유저 상태 변경 (DELETE)
tokenService.validateRefreshToken(deleteUserReq.getUserId(), deleteUserReq.getRefreshToken());
// 유저 entity - 개인 정보 삭제
User user = userRepository.findByUserId(deleteUserReq.getUserId()).orElseThrow(() -> new NotFoundUserException());
user.deleteUser();
// 유저 연관 entity - 정보 삭제

}
}

0 comments on commit 1f13984

Please sign in to comment.