diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/auth/controller/AuthRes.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/auth/controller/AuthRes.java index 083fdaf..7b43d06 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/auth/controller/AuthRes.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/auth/controller/AuthRes.java @@ -10,10 +10,10 @@ public class AuthRes { public record LoginResponse( String accessToken, String refreshToken, - UserRes.UserInfo userInfo + UserRes.UserMyInfo userInfo ) { public static LoginResponse from(JwtToken jwtToken, UserModel.Main userMain) { - var userInfo = UserRes.UserInfo.from(userMain); + var userInfo = UserRes.UserMyInfo.from(userMain); return LoginResponse.builder() .accessToken(jwtToken.getAccessToken()) .refreshToken(jwtToken.getRefreshToken()) diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/user/controller/UserController.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/user/controller/UserController.java index 9e543f5..f7847db 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/user/controller/UserController.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/user/controller/UserController.java @@ -21,11 +21,11 @@ public class UserController { @Operation(summary = "내 정보 조회", description = "내 정보를 조회한다.") @GetMapping("/api/user") - public ApiResponse getUserInfo( + public ApiResponse getUserInfo( @AuthenticationPrincipal JwtUser jwtUser ) { var userModel = userService.getUserModel(jwtUser.getId()); - return ApiResponse.success(UserRes.UserInfo.from(userModel)); + return ApiResponse.success(UserRes.UserMyInfo.from(userModel)); } @Operation(summary = "내 정보 수정", description = "내 정보를 수정한다.") @@ -58,11 +58,11 @@ public ApiResponse getStreak( @Operation(summary = "유저 랭킹 페이징", description = "전체 유저 랭킹을 조회 페이징") @GetMapping("/api/users/ranking") - public ApiResponse> getUsersRanking( + public ApiResponse> getUsersRanking( @Valid PagingRequest request ) { var userModelPage = userService.getUserPagingByRanking(request.toPageable()); - var response = PagingResponse.from(userModelPage, UserRes.UserInfo::from); + var response = PagingResponse.from(userModelPage, UserRes.User::from); return ApiResponse.success(response); } diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/user/controller/UserRes.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/user/controller/UserRes.java index ccf9fe6..5438ba1 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/user/controller/UserRes.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/user/controller/UserRes.java @@ -1,6 +1,7 @@ package org.haedal.zzansuni.user.controller; import lombok.Builder; +import org.haedal.zzansuni.global.security.Role; import org.haedal.zzansuni.user.domain.TierSystem; import org.haedal.zzansuni.user.domain.UserModel; @@ -9,21 +10,23 @@ public class UserRes { @Builder - public record UserInfo( + public record UserMyInfo( Long id, String nickname, String profileImageUrl, String email, - TierInfo tierInfo + TierInfo tierInfo, + Role role ) { - public static UserInfo from(UserModel.Main userMain) { + public static UserMyInfo from(UserModel.Main userMain) { var tierInfo = TierInfo.from(userMain.exp()); - return UserInfo.builder() + return UserMyInfo.builder() .id(userMain.id()) .nickname(userMain.nickname()) .profileImageUrl(userMain.profileImageUrl()) .email(userMain.email()) .tierInfo(tierInfo) + .role(userMain.role()) .build(); } }