diff --git a/doorip-api/src/main/java/org/doorip/user/api/UserApiController.java b/doorip-api/src/main/java/org/doorip/user/api/UserApiController.java index f0154bc..0f15fa9 100644 --- a/doorip-api/src/main/java/org/doorip/user/api/UserApiController.java +++ b/doorip-api/src/main/java/org/doorip/user/api/UserApiController.java @@ -8,6 +8,7 @@ import org.doorip.user.dto.request.UserReissueRequest; import org.doorip.user.dto.request.UserSignInRequest; import org.doorip.user.dto.request.UserSignUpRequest; +import org.doorip.user.dto.response.ProfileGetResponse; import org.doorip.user.dto.response.UserResponse; import org.doorip.user.service.UserService; import org.springframework.http.ResponseEntity; @@ -54,4 +55,10 @@ public ResponseEntity> reissue(@RequestHeader(AUTHORIZATION) fina UserResponse response = userService.reissue(refreshtoken, request); return ApiResponseUtil.success(SuccessMessage.OK, response); } + + @GetMapping("/profile") + public ResponseEntity> getProfile(@UserId final Long userId) { + final ProfileGetResponse response = userService.getProfile(userId); + return ApiResponseUtil.success(SuccessMessage.OK, response); + } } diff --git a/doorip-api/src/main/java/org/doorip/user/dto/response/ProfileGetResponse.java b/doorip-api/src/main/java/org/doorip/user/dto/response/ProfileGetResponse.java new file mode 100644 index 0000000..2e787bc --- /dev/null +++ b/doorip-api/src/main/java/org/doorip/user/dto/response/ProfileGetResponse.java @@ -0,0 +1,18 @@ +package org.doorip.user.dto.response; + +import org.doorip.user.domain.User; + +public record ProfileGetResponse( + String name, + String intro, + int result +) { + + public static ProfileGetResponse of(User user) { + return new ProfileGetResponse( + user.getName(), + user.getIntro(), + user.getResult() + ); + } +} diff --git a/doorip-api/src/main/java/org/doorip/user/service/UserService.java b/doorip-api/src/main/java/org/doorip/user/service/UserService.java index ec242a5..aa1bfdf 100644 --- a/doorip-api/src/main/java/org/doorip/user/service/UserService.java +++ b/doorip-api/src/main/java/org/doorip/user/service/UserService.java @@ -16,6 +16,7 @@ import org.doorip.user.dto.request.UserReissueRequest; import org.doorip.user.dto.request.UserSignInRequest; import org.doorip.user.dto.request.UserSignUpRequest; +import org.doorip.user.dto.response.ProfileGetResponse; import org.doorip.user.dto.response.UserResponse; import org.doorip.user.repository.RefreshTokenRepository; import org.doorip.user.repository.UserRepository; @@ -78,6 +79,11 @@ public UserResponse reissue(String refreshToken, UserReissueRequest request) { return UserResponse.of(issueToken); } + public ProfileGetResponse getProfile(Long userId) { + User findUser = getUser(userId); + return ProfileGetResponse.of(findUser); + } + private String getPlatformId(String token, Platform platform) { if (platform == APPLE) { return appleOAuthProvider.getApplePlatformId(token); diff --git a/doorip-common/src/main/java/org/doorip/message/ErrorMessage.java b/doorip-common/src/main/java/org/doorip/message/ErrorMessage.java index 997a603..79a7c69 100644 --- a/doorip-common/src/main/java/org/doorip/message/ErrorMessage.java +++ b/doorip-common/src/main/java/org/doorip/message/ErrorMessage.java @@ -48,6 +48,7 @@ public enum ErrorMessage { REFRESH_TOKEN_NOT_FOUND(HttpStatus.NOT_FOUND, "e4042", "리프레쉬 토큰을 찾을 수 없습니다."), TRIP_NOT_FOUND(HttpStatus.NOT_FOUND, "e4043", "존재하지 않는 여행입니다."), PARTICIPANT_NOT_FOUND(HttpStatus.NOT_FOUND, "e4044", "존재하지 않는 참여자입니다."), + RESULT_NOT_FOUND(HttpStatus.NOT_FOUND, "e4045", "유저의 성향 결과 값을 찾을 수 없습니다."), /** * 405 Method Not Allowed