diff --git a/src/main/java/com/onnoff/onnoff/auth/controller/LoginController.java b/src/main/java/com/onnoff/onnoff/auth/controller/LoginController.java index a25c0b4..e9f76f8 100644 --- a/src/main/java/com/onnoff/onnoff/auth/controller/LoginController.java +++ b/src/main/java/com/onnoff/onnoff/auth/controller/LoginController.java @@ -80,7 +80,7 @@ public ResponseEntity getAccessToken(@RequestParam(name = "code") String @Operation(summary = "소셜 토큰 검증 API",description = "토큰을 검증 하고 이에 대한 결과를 응답합니다. 추가 정보 입력 여부도 같이 응답 합니다.") @ResponseBody @PostMapping("/oauth2/kakao/token/validate") - public ApiResponse validateKakoToken(HttpServletResponse response, @RequestBody LoginRequestDTO.KakaoTokenValidateDTO requestDTO) { + public ApiResponse validateKakoToken(@RequestBody LoginRequestDTO.KakaoTokenValidateDTO requestDTO) { // identity 토큰 검증 kakaoLoginService.validate(requestDTO.getIdentityToken()); // ok -> 유저 정보 가져오기 @@ -108,7 +108,7 @@ public ApiResponse validateKakoToken(HttpServletRespon @ResponseBody @PostMapping("/oauth2/apple/token/validate") - public ApiResponse validateAppleToken(HttpServletResponse response, @RequestBody LoginRequestDTO.AppleTokenValidateDTO requestDTO) { + public ApiResponse validateAppleToken(@RequestBody LoginRequestDTO.AppleTokenValidateDTO requestDTO) { // 검증하기 appleLoginService.validate(requestDTO.getIdentityToken()); // 검증 성공 시 리프레시 토큰 발급받아 저장(기한 무제한, 회원탈퇴 시 필요) diff --git a/src/main/java/com/onnoff/onnoff/domain/user/converter/UserConverter.java b/src/main/java/com/onnoff/onnoff/domain/user/converter/UserConverter.java index 955c80c..ae14370 100644 --- a/src/main/java/com/onnoff/onnoff/domain/user/converter/UserConverter.java +++ b/src/main/java/com/onnoff/onnoff/domain/user/converter/UserConverter.java @@ -1,5 +1,7 @@ package com.onnoff.onnoff.domain.user.converter; +import com.onnoff.onnoff.apiPayload.code.status.ErrorStatus; +import com.onnoff.onnoff.apiPayload.exception.GeneralException; import com.onnoff.onnoff.auth.dto.LoginRequestDTO; import com.onnoff.onnoff.auth.feignClient.dto.kakao.KakaoOauth2DTO; import com.onnoff.onnoff.domain.user.User; @@ -8,8 +10,18 @@ import com.onnoff.onnoff.domain.user.enums.FieldOfWork; import com.onnoff.onnoff.domain.user.enums.SocialType; +import java.util.EnumSet; + public class UserConverter { public static User toUser(KakaoOauth2DTO.UserInfoResponseDTO response, LoginRequestDTO.AdditionalInfo additionalInfo){ + String fieldOfWork = additionalInfo.getFieldOfWork(); + try{ + FieldOfWork.valueOf(fieldOfWork); + } + catch (IllegalArgumentException e){ + throw new GeneralException(ErrorStatus.INVALID_ENUM_VALUE); + } + ExperienceYear experienceYear = ExperienceYear.fromValue(additionalInfo.getExperienceYear()); return User.builder() .oauthId(response.getSub())