diff --git a/src/main/java/org/hankki/hankkiserver/api/user/controller/UserController.java b/src/main/java/org/hankki/hankkiserver/api/user/controller/UserController.java index e1af870e..a5b41c54 100644 --- a/src/main/java/org/hankki/hankkiserver/api/user/controller/UserController.java +++ b/src/main/java/org/hankki/hankkiserver/api/user/controller/UserController.java @@ -7,7 +7,7 @@ import org.hankki.hankkiserver.api.user.service.UserCommandService; import org.hankki.hankkiserver.api.user.service.UserQueryService; import org.hankki.hankkiserver.api.user.service.command.UserUniversityPostCommand; -import org.hankki.hankkiserver.api.user.service.response.UserProfileAndNicknmaeResponse; +import org.hankki.hankkiserver.api.user.service.response.UserProfileAndNicknameResponse; import org.hankki.hankkiserver.api.user.service.response.UserUniversityFindResponse; import org.hankki.hankkiserver.auth.UserId; import org.hankki.hankkiserver.common.code.CommonSuccessCode; @@ -34,7 +34,7 @@ public HankkiResponse findUserUniversity(@UserId fin } @GetMapping("/users/me") - public HankkiResponse getUserProfileAndNickname(@UserId final Long userId) { + public HankkiResponse getUserProfileAndNickname(@UserId final Long userId) { return HankkiResponse.success(CommonSuccessCode.OK, userQueryService.getUserProfileAndNickname(userId)); } } diff --git a/src/main/java/org/hankki/hankkiserver/api/user/service/UserQueryService.java b/src/main/java/org/hankki/hankkiserver/api/user/service/UserQueryService.java index dd21b49c..0e0f956b 100644 --- a/src/main/java/org/hankki/hankkiserver/api/user/service/UserQueryService.java +++ b/src/main/java/org/hankki/hankkiserver/api/user/service/UserQueryService.java @@ -1,13 +1,11 @@ package org.hankki.hankkiserver.api.user.service; import lombok.RequiredArgsConstructor; -import org.hankki.hankkiserver.api.auth.service.UserFinder; import org.hankki.hankkiserver.api.auth.service.UserInfoFinder; -import org.hankki.hankkiserver.api.user.service.response.UserProfileAndNicknmaeResponse; +import org.hankki.hankkiserver.api.user.service.response.UserProfileAndNicknameResponse; import org.hankki.hankkiserver.api.user.service.response.UserUniversityFindResponse; import org.hankki.hankkiserver.common.code.UserUniversityErrorCode; import org.hankki.hankkiserver.common.exception.NotFoundException; -import org.hankki.hankkiserver.domain.user.model.UserInfo; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -25,8 +23,7 @@ public UserUniversityFindResponse findUserUniversity(Long userId) { } @Transactional(readOnly = true) - public UserProfileAndNicknmaeResponse getUserProfileAndNickname(final Long userId) { - UserInfo userInfo = userInfoFinder.getUserInfo(userId); - return UserProfileAndNicknmaeResponse.of(userInfo.getNickname(), userInfo.getProfileImageUrl()); + public UserProfileAndNicknameResponse getUserProfileAndNickname(final Long userId) { + return UserProfileAndNicknameResponse.of(userInfoFinder.getUserInfo(userId)); } } diff --git a/src/main/java/org/hankki/hankkiserver/api/user/service/response/UserProfileAndNicknameResponse.java b/src/main/java/org/hankki/hankkiserver/api/user/service/response/UserProfileAndNicknameResponse.java new file mode 100644 index 00000000..d23e7da1 --- /dev/null +++ b/src/main/java/org/hankki/hankkiserver/api/user/service/response/UserProfileAndNicknameResponse.java @@ -0,0 +1,12 @@ +package org.hankki.hankkiserver.api.user.service.response; + +import org.hankki.hankkiserver.domain.user.model.UserInfo; + +public record UserProfileAndNicknameResponse( + String nickname, + String profileImageUrl +) { + public static UserProfileAndNicknameResponse of(UserInfo userInfo) { + return new UserProfileAndNicknameResponse(userInfo.getNickname(), userInfo.getProfileImageUrl()); + } +} diff --git a/src/main/java/org/hankki/hankkiserver/api/user/service/response/UserProfileAndNicknmaeResponse.java b/src/main/java/org/hankki/hankkiserver/api/user/service/response/UserProfileAndNicknmaeResponse.java deleted file mode 100644 index c4f3b77c..00000000 --- a/src/main/java/org/hankki/hankkiserver/api/user/service/response/UserProfileAndNicknmaeResponse.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.hankki.hankkiserver.api.user.service.response; - -public record UserProfileAndNicknmaeResponse( - String nickname, - String profileImageUrl -) { - public static UserProfileAndNicknmaeResponse of(String nickname, String profileImageUrl) { - return new UserProfileAndNicknmaeResponse(nickname, profileImageUrl); - } -}