Skip to content

Commit

Permalink
[Feat]: 유저 내정보조회,랭킹 컨트롤러 추가 (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
bayy1216 committed May 31, 2024
1 parent 768cbba commit 84f6c95
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.haedal.zzansuni.controller.PagingRequest;
import org.haedal.zzansuni.controller.PagingResponse;
import org.haedal.zzansuni.core.api.ApiResponse;
import org.haedal.zzansuni.domain.user.UserService;
Expand All @@ -14,7 +15,6 @@

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@Tag(name = "user", description = "유저 API")
@RequiredArgsConstructor
Expand All @@ -27,11 +27,8 @@ public class UserController {
public ApiResponse<UserRes.UserInfoDto> getUserInfo(
@AuthenticationPrincipal JwtUser jwtUser
) {
return ApiResponse.success(
new UserRes.UserInfoDto(1L, "nickname", "https://picsum.photos/200/300", "email",
new UserRes.TierInfoDto("tier", 100, 50)
)
);
var userModel = userService.getUserModel(jwtUser.getId());
return ApiResponse.success(UserRes.UserInfoDto.from(userModel));
}

@Operation(summary = "내 정보 수정", description = "내 정보를 수정한다.")
Expand Down Expand Up @@ -61,13 +58,13 @@ public ApiResponse<List<UserRes.StrickDto>> getStrick(

@Operation(summary = "유저 랭킹 페이징", description = "전체 유저 랭킹을 조회 페이징")
@GetMapping("/api/users/ranking")
public ApiResponse<PagingResponse<Void>> getUsersRanking(
@Valid @RequestParam Long page
public ApiResponse<PagingResponse<UserRes.UserInfoDto>> getUsersRanking(
@Valid PagingRequest request
) {
// TODO
return ApiResponse.success(null);
var userModelPage = userService.getUserPagingByRanking(request.toPageable());
var response = PagingResponse.from(userModelPage, UserRes.UserInfoDto::from);
return ApiResponse.success(response);
}



}

0 comments on commit 84f6c95

Please sign in to comment.