Skip to content

Commit

Permalink
[refac] typo correction and encapsulation variable
Browse files Browse the repository at this point in the history
  • Loading branch information
kgy1008 committed Jul 14, 2024
1 parent d8f9b79 commit 2bdef30
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,7 +34,7 @@ public HankkiResponse<UserUniversityFindResponse> findUserUniversity(@UserId fin
}

@GetMapping("/users/me")
public HankkiResponse<UserProfileAndNicknmaeResponse> getUserProfileAndNickname(@UserId final Long userId) {
public HankkiResponse<UserProfileAndNicknameResponse> getUserProfileAndNickname(@UserId final Long userId) {
return HankkiResponse.success(CommonSuccessCode.OK, userQueryService.getUserProfileAndNickname(userId));
}
}
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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));
}
}
Original file line number Diff line number Diff line change
@@ -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());
}
}

This file was deleted.

0 comments on commit 2bdef30

Please sign in to comment.