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 deleted file mode 100644 index df6af68..0000000 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/ChallengeController.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.haedal.zzansuni.controller.challenge; - -import io.swagger.v3.oas.annotations.Operation; -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.challenge.ChallengeCategory; -import org.haedal.zzansuni.global.jwt.JwtUser; -import org.springframework.security.core.annotation.AuthenticationPrincipal; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -@Tag(name = "challenges", description = "챌린지 관련 API") -@RequiredArgsConstructor -@RestController -public class ChallengeController { - - @Operation(summary = "챌린지 목록 조회", description = "챌린지 목록 페이징 조회한다.") - @GetMapping("/api/challenges") - public ApiResponse> getChallengesPaging( - @Valid PagingRequest pagingRequest, - @RequestParam ChallengeCategory category - ) { - throw new RuntimeException("Not implemented"); - } - - @Operation(summary = "챌린지 상세 조회", description = "챌린지 상세 조회한다.") - @GetMapping("/api/challenges/{challengeId}") - public ApiResponse getChallengeDetail( - @PathVariable Long challengeId - ) { - throw new RuntimeException("Not implemented"); - } - - @Operation(summary = "챌린지 최근 리뷰 조회", description = "챌린지 최근 리뷰 조회한다.") - @GetMapping("/api/challenges/reviews") - public ApiResponse> getChallengeReviews( - @Valid PagingRequest pagingRequest - ) { - throw new RuntimeException("Not implemented"); - } - - @Operation(summary = "챌린지 랭킹 조회", description = "챌린지 랭킹 조회한다.") - @GetMapping("/api/challenges/{challengeId}/rankings") - public ApiResponse getChallengeRankings( - @AuthenticationPrincipal JwtUser jwtUser, - @PathVariable Long challengeId, - @Valid PagingRequest pagingRequest - ) { - throw new RuntimeException("Not implemented"); - } - - //숏폼 조회 - @Operation(summary = "챌린지 숏폼 조회", description = "챌린지 숏폼 조회한다.") - @GetMapping("/api/challenges/shorts") - public ApiResponse> getChallengeShortsPaging( - @RequestParam Long page - ) { - throw new RuntimeException("Not implemented"); - } - - @Operation(summary = "진행중인 챌린지 조회", description = "진행중인 챌린지 조회한다.") - @GetMapping("/api/user/challenges/currents") - public ApiResponse> getChallengeCurrentsPaging( - @Valid PagingRequest pagingRequest, - @AuthenticationPrincipal JwtUser jwtUser - ) { - throw new RuntimeException("Not implemented"); - } - - @Operation(summary = "완료한 챌린지 조회", description = "완료한 챌린지 페이징 조회한다.") - @GetMapping("/api/user/challenges/completes") - public ApiResponse> getChallengeCompletesPaging( - @Valid PagingRequest pagingRequest, - @AuthenticationPrincipal JwtUser jwtUser - ) { - throw new RuntimeException("Not implemented"); - } - -} diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/ChallengeReq.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/ChallengeReq.java deleted file mode 100644 index 48eee62..0000000 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/ChallengeReq.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.haedal.zzansuni.controller.challenge; - -import org.haedal.zzansuni.controller.user.UserRes; - -public class ChallengeReq { - -} 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 deleted file mode 100644 index ca1c26e..0000000 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/interact/ChallengeInteractRes.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.haedal.zzansuni.controller.challenge.interact; - -import lombok.Builder; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.List; - -public class ChallengeInteractRes { - @Builder - public record ChallengeVerificationResponse( - Integer totalCount, - Integer successCount, - Integer obtainExp - ) { - } - - @Builder - public record ChallengeRecordResponse( - String title, - Integer totalCount, - Integer successCount, - LocalDate startDate, - LocalDate endDate, - List recordIds - ) { - } - - @Builder - public record ChallengeRecordDetailDto( - Long id, - LocalDateTime createdAt, - String content, - String imageUrl - ) { - } -} 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 new file mode 100644 index 0000000..74b463e --- /dev/null +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/ChallengeGroupController.java @@ -0,0 +1,69 @@ +package org.haedal.zzansuni.controller.challengegroup; + +import io.swagger.v3.oas.annotations.Operation; +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.challenge.ChallengeCategory; +import org.haedal.zzansuni.global.jwt.JwtUser; +import org.springframework.security.core.annotation.AuthenticationPrincipal; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@Tag(name = "challengeGroups", description = "챌린지 그룹 관련 API") +@RequiredArgsConstructor +@RestController +public class ChallengeGroupController { + + @Operation(summary = "챌린지 그룹 목록 페이징", description = "챌린지 그룹 페이징 조회.") + @GetMapping("/api/challengeGroups") + public ApiResponse> getChallengesPaging( + @Valid PagingRequest pagingRequest, + @RequestParam ChallengeCategory category + ) { + throw new RuntimeException("Not implemented"); + } + + @Operation(summary = "챌린지 그룹 상세 조회", description = "챌린지 상세 조회한다.") + @GetMapping("/api/challengeGroups/{challengeGroupId}") + public ApiResponse getChallengeDetail( + @PathVariable Long challengeGroupId + ) { + throw new RuntimeException("Not implemented"); + } + + @Operation(summary = "챌린지 그룹 최근 리뷰 페이징", description = "챌린지 최근 리뷰 페이징 조회.") + @GetMapping("/api/challengeGroups/reviews") + public ApiResponse> getChallengeReviews( + @Valid PagingRequest pagingRequest + ) { + throw new RuntimeException("Not implemented"); + } + + @Operation(summary = "챌린지 그룹 랭킹 조회", description = "챌린지 랭킹 조회한다.") + @GetMapping("/api/challengeGroups/{challengeGroupId}/rankings") + public ApiResponse getChallengeRankings( + @AuthenticationPrincipal JwtUser jwtUser, + @PathVariable Long challengeGroupId, + @Valid PagingRequest pagingRequest + ) { + throw new RuntimeException("Not implemented"); + } + + //숏폼 조회 + @Operation(summary = "챌린지 그룹 숏폼 페이징", description = "챌린지 숏폼 페이징 조회한다.") + @GetMapping("/api/challengeGroups/shorts") + public ApiResponse> getChallengeShortsPaging( + @RequestParam Long page + ) { + throw new RuntimeException("Not implemented"); + } + + + +} diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/ChallengeGroupReq.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/ChallengeGroupReq.java new file mode 100644 index 0000000..440b95b --- /dev/null +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/ChallengeGroupReq.java @@ -0,0 +1,5 @@ +package org.haedal.zzansuni.controller.challengegroup; + +public class ChallengeGroupReq { + +} 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/challengegroup/ChallengeGroupRes.java similarity index 59% rename from zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/ChallengeRes.java rename to zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/ChallengeGroupRes.java index 917b49d..ba89612 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/challengegroup/ChallengeGroupRes.java @@ -1,19 +1,18 @@ -package org.haedal.zzansuni.controller.challenge; +package org.haedal.zzansuni.controller.challengegroup; import lombok.Builder; import org.haedal.zzansuni.controller.user.UserRes; import org.haedal.zzansuni.domain.challenge.ChallengeCategory; import org.haedal.zzansuni.domain.challenge.DayType; -import org.springframework.cglib.core.Local; import java.time.LocalDate; import java.util.List; -public class ChallengeRes { +public class ChallengeGroupRes { @Builder - public record ChallengeDto( + public record ChallengeGroupDto( Long id, String title, String content, @@ -26,7 +25,7 @@ public record ChallengeDto( } @Builder - public record ChallengeDetailDto( + public record ChallengeGroupDetailDto( Long id, String title, String content, @@ -37,12 +36,12 @@ public record ChallengeDetailDto( ///// Integer maxDifficulty, List imageUrls, - List difficulties + List challenges ) { } @Builder - public record ChallengeDifficultyDto( + public record ChallengeDto( Long id, Integer participantCount, @@ -67,16 +66,16 @@ public record ChallengeReviewDto( @Builder - public record ChallengeRankingPagingResponse( - List data, + public record ChallengeGroupRankingPagingResponse( + List data, Integer totalPage, - ChallengeRankingDto myRanking //null이면 랭킹이 없는 것 + ChallengeGroupRankingDto myRanking //null이면 랭킹이 없는 것 ) { } @Builder - public record ChallengeRankingDto( + public record ChallengeGroupRankingDto( Integer ranking, //획득 포인트 Integer acquiredPoint, @@ -85,33 +84,4 @@ public record ChallengeRankingDto( } - @Builder - public record ChallengeCurrentDto( - Long id, - String title, - Integer successCount, - Integer totalCount, - - LocalDate participationDate, - LocalDate startDate, - LocalDate endDate, - - ChallengeCategory category, - Boolean reviewWritten - - ) { - } - - @Builder - public record ChallengeCompleteDto( - Long id, - String title, - - LocalDate successDate, - - ChallengeCategory category, - Boolean reviewWritten - - ) { - } } 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/challengegroup/challenge/ChallengeController.java similarity index 60% rename from zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/interact/ChallengeInteractController.java rename to zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/challenge/ChallengeController.java index 9bffd22..8531ac2 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/challengegroup/challenge/ChallengeController.java @@ -1,8 +1,10 @@ -package org.haedal.zzansuni.controller.challenge.interact; +package org.haedal.zzansuni.controller.challengegroup.challenge; import io.swagger.v3.oas.annotations.Operation; 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.global.jwt.JwtUser; @@ -11,10 +13,10 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; -@Tag(name = "challenge-interact", description = "챌린지 상호작용 API") +@Tag(name = "challenge", description = "챌린지 API") @RequiredArgsConstructor @RestController -public class ChallengeInteractController { +public class ChallengeController { @Operation(summary = "챌린지 참여", description = "챌린지에 참여한다.") @PostMapping("/api/challenges/{challengeId}/join") @@ -27,9 +29,9 @@ public ApiResponse challengeParticipation( @Operation(summary = "챌린지 인증", description = "챌린지에 인증한다.") @PostMapping("/api/challenges/{challengeId}/verification") - public ApiResponse challengeVerification( + public ApiResponse challengeVerification( @PathVariable Long challengeId, - @RequestPart("body") ChallengeInteractReq.ChallengeVerificationRequest request, + @RequestPart("body") ChallengeReq.ChallengeVerificationRequest request, @RequestPart("image") MultipartFile image ) { throw new RuntimeException("Not implemented"); @@ -41,14 +43,14 @@ public ApiResponse challenge public ApiResponse challengeReviewCreate( @PathVariable Long challengeId, @AuthenticationPrincipal JwtUser jwtUser, - @RequestBody ChallengeInteractReq.ChallengeReviewCreateRequest request + @RequestBody ChallengeReq.ChallengeReviewCreateRequest request ) { throw new RuntimeException("Not implemented"); } @Operation(summary = "챌린지 기록 조회", description = "챌린지 기록을 조회한다.") @GetMapping("/api/challenges/{challengeId}/record") - public ApiResponse getChallengeRecord( + public ApiResponse getChallengeRecord( @PathVariable Long challengeId, @AuthenticationPrincipal JwtUser jwtUser ) { @@ -57,11 +59,27 @@ public ApiResponse getChallengeRec @Operation(summary = "챌린지 기록 상세 조회", description = "챌린지 기록 상세를 조회한다.") @GetMapping("/api/challenges/record/{recordId}") - public ApiResponse getChallengeRecordDetail( + public ApiResponse getChallengeRecordDetail( @PathVariable Long recordId, @AuthenticationPrincipal JwtUser jwtUser ) { throw new RuntimeException("Not implemented"); } + @Operation(summary = "진행중인 챌린지 조회", description = "진행중인 챌린지 조회한다.") + @GetMapping("/api/user/challenges/currents") + public ApiResponse> getChallengeCurrentsPaging( + @Valid PagingRequest pagingRequest, + @AuthenticationPrincipal JwtUser jwtUser + ) { + throw new RuntimeException("Not implemented"); + } + @Operation(summary = "완료한 챌린지 조회", description = "완료한 챌린지 페이징 조회한다.") + @GetMapping("/api/user/challenges/completes") + public ApiResponse> getChallengeCompletesPaging( + @Valid PagingRequest pagingRequest, + @AuthenticationPrincipal JwtUser jwtUser + ) { + throw new RuntimeException("Not implemented"); + } } diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/interact/ChallengeInteractReq.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/challenge/ChallengeReq.java similarity index 58% rename from zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/interact/ChallengeInteractReq.java rename to zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/challenge/ChallengeReq.java index da209e0..89af4a0 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challenge/interact/ChallengeInteractReq.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/challenge/ChallengeReq.java @@ -1,8 +1,6 @@ -package org.haedal.zzansuni.controller.challenge.interact; +package org.haedal.zzansuni.controller.challengegroup.challenge; -import org.springframework.web.multipart.MultipartFile; - -public class ChallengeInteractReq { +public class ChallengeReq { public record ChallengeVerificationRequest( String content diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/challenge/ChallengeRes.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/challenge/ChallengeRes.java new file mode 100644 index 0000000..ee0fc80 --- /dev/null +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/challenge/ChallengeRes.java @@ -0,0 +1,72 @@ +package org.haedal.zzansuni.controller.challengegroup.challenge; + +import lombok.Builder; +import org.haedal.zzansuni.domain.challenge.ChallengeCategory; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +public class ChallengeRes { + @Builder + public record ChallengeVerificationResponse( + Integer totalCount, + Integer successCount, + Integer obtainExp + ) { + } + + @Builder + public record ChallengeRecordResponse( + String title, + Integer totalCount, + Integer successCount, + LocalDate startDate, + LocalDate endDate, + List recordIds + ) { + } + + @Builder + public record ChallengeRecordDetailDto( + Long id, + LocalDateTime createdAt, + String content, + String imageUrl + ) { + } + + + + + + @Builder + public record ChallengeCurrentDto( + Long id, + String title, + Integer successCount, + Integer totalCount, + + LocalDate participationDate, + LocalDate startDate, + LocalDate endDate, + + ChallengeCategory category, + Boolean reviewWritten + + ) { + } + + @Builder + public record ChallengeCompleteDto( + Long id, + String title, + + LocalDate successDate, + + ChallengeCategory category, + Boolean reviewWritten + + ) { + } +} 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 f46d6c9..f2ba2a6 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 @@ -3,6 +3,7 @@ import lombok.Builder; import java.time.LocalDate; +import java.util.List; import java.util.Map; public class UserRes { @@ -36,7 +37,18 @@ public record TierInfoDto( @Builder public record StrickDto( LocalDate date, - Map activity + List dayCounts + ) { + } + + /** + * 하루에 대한 스트릭 카운트 + * 0인 것도 보낸다. + */ + @Builder + public record DayCountDto( + LocalDate date, + Integer count ) { }