From 1e85b8360abb721a4b43f93c969ff7a2fb0cf287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=90=ED=99=8D=EC=84=9D?= <78216059+bayy1216@users.noreply.github.com> Date: Thu, 30 May 2024 13:22:05 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]:=20api=20=EB=B3=80=EA=B2=BD=201=EC=B0=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/haedal/zzansuni/controller/PagingResponse.java | 2 ++ .../haedal/zzansuni/controller/auth/AuthController.java | 2 +- .../zzansuni/controller/challenge/ChallengeController.java | 4 ++-- .../haedal/zzansuni/controller/challenge/ChallengeRes.java | 3 ++- .../challenge/interact/ChallengeInteractController.java | 7 +++---- .../challenge/interact/ChallengeInteractRes.java | 2 +- .../haedal/zzansuni/controller/user/UserController.java | 2 +- .../java/org/haedal/zzansuni/controller/user/UserRes.java | 6 +++--- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/PagingResponse.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/PagingResponse.java index 0bc6b7a..0bfa93a 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/PagingResponse.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/PagingResponse.java @@ -9,6 +9,7 @@ @Builder public record PagingResponse( Integer totalPage, + Boolean hasNext, List data ) { @@ -22,6 +23,7 @@ public static PagingResponse from( ) { return PagingResponse.builder() .totalPage(page.getTotalPages()) + .hasNext(page.hasNext()) .data(page.getContent().stream().map(converter).toList()) .build(); diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/auth/AuthController.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/auth/AuthController.java index 63d620b..5ec4fd6 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/auth/AuthController.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/auth/AuthController.java @@ -21,7 +21,7 @@ public ApiResponse oauth2(@RequestBody @Valid AuthReq.OAu return ApiResponse.success( new AuthRes.LoginResponse("accessToken", "refresh", new UserRes.UserInfoDto( 1L, "nickname", "profileImageUrl", "email", - new UserRes.TierDto("tier", 100, 50) + new UserRes.TierInfoDto("tier", 100, 50) ))); } diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/ChallengeController.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/ChallengeController.java index 85492cb..7609d87 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/ChallengeController.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/ChallengeController.java @@ -63,7 +63,7 @@ public ApiResponse> getChallengeShorts } @Operation(summary = "진행중인 챌린지 조회", description = "진행중인 챌린지 조회한다.") - @GetMapping("/api/challenges/currents") + @GetMapping("/api/user/challenges/currents") public ApiResponse> getChallengeCurrentsPaging( @Valid PagingRequest pagingRequest, @AuthenticationPrincipal JwtUser jwtUser @@ -72,7 +72,7 @@ public ApiResponse> getChalleng } @Operation(summary = "완료한 챌린지 조회", description = "완료한 챌린지 페이징 조회한다.") - @GetMapping("/api/challenges/completes") + @GetMapping("/api/user/challenges/completes") public ApiResponse> getChallengeCompletesPaging( @Valid PagingRequest pagingRequest, @AuthenticationPrincipal JwtUser jwtUser diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/ChallengeRes.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/ChallengeRes.java index e4b1eaf..aed9d19 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/ChallengeRes.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/ChallengeRes.java @@ -34,7 +34,8 @@ public record ChallengeDetailDto( LocalDate endDate, ChallengeCategory category, ///// - List imageUrl, + Integer maxDifficulty, + List imageUrls, List difficulties ) { } diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/interact/ChallengeInteractController.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/interact/ChallengeInteractController.java index 49c1f5e..e9b3840 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/interact/ChallengeInteractController.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/interact/ChallengeInteractController.java @@ -16,11 +16,11 @@ @RestController public class ChallengeInteractController { - @Operation(summary = "챌린지 참여", description = "챌린지에 참여한다.") + @Operation(summary = "챌린지 인증", description = "챌린지에 인증한다.") @PostMapping("/api/challenges/{challengeId}/verification") public ApiResponse challengeVerification( @PathVariable Long challengeId, - @RequestPart("content") ChallengeInteractReq.ChallengeVerificationRequest request, + @RequestPart("body") ChallengeInteractReq.ChallengeVerificationRequest request, @RequestPart("image") MultipartFile image ) { throw new RuntimeException("Not implemented"); @@ -47,9 +47,8 @@ public ApiResponse getChallengeRec } @Operation(summary = "챌린지 기록 상세 조회", description = "챌린지 기록 상세를 조회한다.") - @GetMapping("/api/challenges/{challengeId}/record/{recordId}") + @GetMapping("/api/challenges/record/{recordId}") public ApiResponse getChallengeRecordDetail( - @PathVariable Long challengeId, @PathVariable Long recordId, @AuthenticationPrincipal JwtUser jwtUser ) { diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/interact/ChallengeInteractRes.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/interact/ChallengeInteractRes.java index 63ebddd..798ccec 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/interact/ChallengeInteractRes.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/interact/ChallengeInteractRes.java @@ -21,7 +21,7 @@ public record ChallengeRecordResponse( Integer successCount, LocalDate startDate, LocalDate endDate, - List recordDetailIds + List recordIds ) { } diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/user/UserController.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/user/UserController.java index 234f015..dd843d8 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/user/UserController.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/user/UserController.java @@ -28,7 +28,7 @@ public ApiResponse getUserInfo( ) { return ApiResponse.success( new UserRes.UserInfoDto(1L, "nickname", "profileImageUrl", "email", - new UserRes.TierDto("tier", 100, 50) + new UserRes.TierInfoDto("tier", 100, 50) ) ); } diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/user/UserRes.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/user/UserRes.java index a7c5826..41d76f1 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/user/UserRes.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/user/UserRes.java @@ -12,7 +12,7 @@ public record UserInfoDto( String nickname, String profileImageUrl, String email, - TierDto tier + TierInfoDto tierInfo ) { } @@ -21,12 +21,12 @@ public record UserDto( Long id, String nickname, String profileImageUrl, - TierDto tier + TierInfoDto tier ) { } @Builder - public record TierDto( + public record TierInfoDto( String tier, Integer totalExp, Integer currentExp