From dde83e1b840f02af500bbddfa8f869cc38e131ff 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 17:14:09 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]:=20=EB=8D=94=EB=AF=B8=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=B6=9C=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/auth/AuthController.java | 2 +- .../ChallengeGroupController.java | 99 ++++++++++++++++--- .../controller/user/UserController.java | 2 +- 3 files changed, 88 insertions(+), 15 deletions(-) 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 5ec4fd6..8f2f475 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 @@ -20,7 +20,7 @@ public class AuthController { public ApiResponse oauth2(@RequestBody @Valid AuthReq.OAuth2LoginRequest request) { return ApiResponse.success( new AuthRes.LoginResponse("accessToken", "refresh", new UserRes.UserInfoDto( - 1L, "nickname", "profileImageUrl", "email", + 1L, "nickname", "https://picsum.photos/200/300", "email", new UserRes.TierInfoDto("tier", 100, 50) ))); } diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/ChallengeGroupController.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/ChallengeGroupController.java index dc1b052..44a8b02 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/ChallengeGroupController.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/ChallengeGroupController.java @@ -6,8 +6,10 @@ import lombok.RequiredArgsConstructor; import org.haedal.zzansuni.controller.PagingRequest; import org.haedal.zzansuni.controller.PagingResponse; +import org.haedal.zzansuni.controller.user.UserRes; import org.haedal.zzansuni.core.api.ApiResponse; import org.haedal.zzansuni.domain.challengegroup.ChallengeCategory; +import org.haedal.zzansuni.domain.challengegroup.DayType; import org.haedal.zzansuni.global.jwt.JwtUser; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.GetMapping; @@ -15,6 +17,9 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.time.LocalDate; +import java.util.List; + @Tag(name = "challengeGroups", description = "챌린지 그룹 관련 API") @RequiredArgsConstructor @RestController @@ -23,45 +28,113 @@ public class ChallengeGroupController { @Operation(summary = "챌린지 그룹 목록 페이징", description = "챌린지 그룹 페이징 조회.") @GetMapping("/api/challengeGroups") public ApiResponse> getChallengesPaging( - @Valid PagingRequest pagingRequest, - @RequestParam ChallengeCategory category + @Valid PagingRequest pagingRequest, + @RequestParam ChallengeCategory category ) { - throw new RuntimeException("Not implemented"); + return ApiResponse.success(PagingResponse.builder() + .hasNext(false) + .totalPage(1) + .data(List.of( + new ChallengeGroupRes.ChallengeGroupDto(1L, + "title", "thumbnailUrl", 12, + LocalDate.now(), LocalDate.now(), ChallengeCategory.VOLUNTEER) + )) + .build()); } @Operation(summary = "챌린지 그룹 상세 조회", description = "챌린지 상세 조회한다.") @GetMapping("/api/challengeGroups/{challengeGroupId}") public ApiResponse getChallengeDetail( - @PathVariable Long challengeGroupId + @PathVariable Long challengeGroupId ) { - throw new RuntimeException("Not implemented"); + return ApiResponse.success( + new ChallengeGroupRes.ChallengeGroupDetailDto( + 1L, "title", "thumbnailUrl", 12, + LocalDate.now(), LocalDate.now(), ChallengeCategory.VOLUNTEER, + 12, + List.of("https://picsum.photos/200/300"), + List.of( + new ChallengeGroupRes.ChallengeDto( + 1L, 12,1,1,1, DayType.DAY, 12 + ) + ) + ) + ); } @Operation(summary = "챌린지 그룹 최근 리뷰 페이징", description = "챌린지 최근 리뷰 페이징 조회.") @GetMapping("/api/challengeGroups/reviews") public ApiResponse> getChallengeReviews( - @Valid PagingRequest pagingRequest + @Valid PagingRequest pagingRequest ) { - throw new RuntimeException("Not implemented"); + return ApiResponse.success( + PagingResponse.builder() + .hasNext(false) + .totalPage(1) + .data(List.of( + new ChallengeGroupRes.ChallengeReviewDto( + 1L, "title", + new UserRes.UserDto( + 1L, "nickname", "https://picsum.photos/200/300", new UserRes.TierInfoDto( + "tier", 100, 50 + )), + "content", 12 + + ) + )) + .build() + ); } @Operation(summary = "챌린지 그룹 랭킹 조회", description = "챌린지 랭킹 조회한다.") @GetMapping("/api/challengeGroups/{challengeGroupId}/rankings") public ApiResponse getChallengeRankings( - @AuthenticationPrincipal JwtUser jwtUser, - @PathVariable Long challengeGroupId, - @Valid PagingRequest pagingRequest + @AuthenticationPrincipal JwtUser jwtUser, + @PathVariable Long challengeGroupId, + @Valid PagingRequest pagingRequest ) { - throw new RuntimeException("Not implemented"); + return ApiResponse.success( + new ChallengeGroupRes.ChallengeGroupRankingPagingResponse( + List.of( + new ChallengeGroupRes.ChallengeGroupRankingDto(1, 12, + new UserRes.UserDto( + 1L, "nickname", "https://picsum.photos/200/300", new UserRes.TierInfoDto( + "tier", 100, 50 + + ) + ) + ) + ), + 1, + new ChallengeGroupRes.ChallengeGroupRankingDto( + 1, 12, + new UserRes.UserDto( + 1L, "nickname", "https://picsum.photos/200/300", new UserRes.TierInfoDto( + "tier", 100, 50 + ) + ) + ) + )); } //숏폼 조회 @Operation(summary = "챌린지 그룹 숏폼 페이징", description = "챌린지 숏폼 페이징 조회한다.") @GetMapping("/api/challengeGroups/shorts") public ApiResponse> getChallengeShortsPaging( - @RequestParam Long page + @RequestParam Long page ) { - throw new RuntimeException("Not implemented"); + return ApiResponse.success( + PagingResponse.builder() + .hasNext(false) + .totalPage(1) + .data(List.of( + new ChallengeGroupRes.ChallengeGroupDto(1L, + "title", "thumbnailUrl", 12, + LocalDate.now(), LocalDate.now(), ChallengeCategory.VOLUNTEER) + )) + .build() + ); + } 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 a3cae3d..912245a 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( @AuthenticationPrincipal JwtUser jwtUser ) { return ApiResponse.success( - new UserRes.UserInfoDto(1L, "nickname", "profileImageUrl", "email", + new UserRes.UserInfoDto(1L, "nickname", "https://picsum.photos/200/300", "email", new UserRes.TierInfoDto("tier", 100, 50) ) );