Skip to content

Commit

Permalink
[Feat]: 챌린지, 챌린지그룹으로 api 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
bayy1216 committed May 30, 2024
1 parent 2d81c0e commit 54d8ea0
Show file tree
Hide file tree
Showing 10 changed files with 197 additions and 182 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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<PagingResponse<ChallengeGroupRes.ChallengeGroupDto>> getChallengesPaging(
@Valid PagingRequest pagingRequest,
@RequestParam ChallengeCategory category
) {
throw new RuntimeException("Not implemented");
}

@Operation(summary = "챌린지 그룹 상세 조회", description = "챌린지 상세 조회한다.")
@GetMapping("/api/challengeGroups/{challengeGroupId}")
public ApiResponse<ChallengeGroupRes.ChallengeGroupDetailDto> getChallengeDetail(
@PathVariable Long challengeGroupId
) {
throw new RuntimeException("Not implemented");
}

@Operation(summary = "챌린지 그룹 최근 리뷰 페이징", description = "챌린지 최근 리뷰 페이징 조회.")
@GetMapping("/api/challengeGroups/reviews")
public ApiResponse<PagingResponse<ChallengeGroupRes.ChallengeReviewDto>> getChallengeReviews(
@Valid PagingRequest pagingRequest
) {
throw new RuntimeException("Not implemented");
}

@Operation(summary = "챌린지 그룹 랭킹 조회", description = "챌린지 랭킹 조회한다.")
@GetMapping("/api/challengeGroups/{challengeGroupId}/rankings")
public ApiResponse<ChallengeGroupRes.ChallengeGroupRankingPagingResponse> getChallengeRankings(
@AuthenticationPrincipal JwtUser jwtUser,
@PathVariable Long challengeGroupId,
@Valid PagingRequest pagingRequest
) {
throw new RuntimeException("Not implemented");
}

//숏폼 조회
@Operation(summary = "챌린지 그룹 숏폼 페이징", description = "챌린지 숏폼 페이징 조회한다.")
@GetMapping("/api/challengeGroups/shorts")
public ApiResponse<PagingResponse<ChallengeGroupRes.ChallengeGroupDto>> getChallengeShortsPaging(
@RequestParam Long page
) {
throw new RuntimeException("Not implemented");
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.haedal.zzansuni.controller.challengegroup;

public class ChallengeGroupReq {

}
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -26,7 +25,7 @@ public record ChallengeDto(
}

@Builder
public record ChallengeDetailDto(
public record ChallengeGroupDetailDto(
Long id,
String title,
String content,
Expand All @@ -37,12 +36,12 @@ public record ChallengeDetailDto(
/////
Integer maxDifficulty,
List<String> imageUrls,
List<ChallengeDifficultyDto> difficulties
List<ChallengeDto> challenges
) {
}

@Builder
public record ChallengeDifficultyDto(
public record ChallengeDto(
Long id,
Integer participantCount,

Expand All @@ -67,16 +66,16 @@ public record ChallengeReviewDto(


@Builder
public record ChallengeRankingPagingResponse(
List<ChallengeRankingDto> data,
public record ChallengeGroupRankingPagingResponse(
List<ChallengeGroupRankingDto> data,
Integer totalPage,
ChallengeRankingDto myRanking //null이면 랭킹이 없는 것
ChallengeGroupRankingDto myRanking //null이면 랭킹이 없는 것
) {
}


@Builder
public record ChallengeRankingDto(
public record ChallengeGroupRankingDto(
Integer ranking,
//획득 포인트
Integer acquiredPoint,
Expand All @@ -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

) {
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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")
Expand All @@ -27,9 +29,9 @@ public ApiResponse<Void> challengeParticipation(

@Operation(summary = "챌린지 인증", description = "챌린지에 인증한다.")
@PostMapping("/api/challenges/{challengeId}/verification")
public ApiResponse<ChallengeInteractRes.ChallengeVerificationResponse> challengeVerification(
public ApiResponse<ChallengeRes.ChallengeVerificationResponse> challengeVerification(
@PathVariable Long challengeId,
@RequestPart("body") ChallengeInteractReq.ChallengeVerificationRequest request,
@RequestPart("body") ChallengeReq.ChallengeVerificationRequest request,
@RequestPart("image") MultipartFile image
) {
throw new RuntimeException("Not implemented");
Expand All @@ -41,14 +43,14 @@ public ApiResponse<ChallengeInteractRes.ChallengeVerificationResponse> challenge
public ApiResponse<Long> 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<ChallengeInteractRes.ChallengeRecordResponse> getChallengeRecord(
public ApiResponse<ChallengeRes.ChallengeRecordResponse> getChallengeRecord(
@PathVariable Long challengeId,
@AuthenticationPrincipal JwtUser jwtUser
) {
Expand All @@ -57,11 +59,27 @@ public ApiResponse<ChallengeInteractRes.ChallengeRecordResponse> getChallengeRec

@Operation(summary = "챌린지 기록 상세 조회", description = "챌린지 기록 상세를 조회한다.")
@GetMapping("/api/challenges/record/{recordId}")
public ApiResponse<ChallengeInteractRes.ChallengeRecordDetailDto> getChallengeRecordDetail(
public ApiResponse<ChallengeRes.ChallengeRecordDetailDto> getChallengeRecordDetail(
@PathVariable Long recordId,
@AuthenticationPrincipal JwtUser jwtUser
) {
throw new RuntimeException("Not implemented");
}
@Operation(summary = "진행중인 챌린지 조회", description = "진행중인 챌린지 조회한다.")
@GetMapping("/api/user/challenges/currents")
public ApiResponse<PagingResponse<ChallengeRes.ChallengeCurrentDto>> getChallengeCurrentsPaging(
@Valid PagingRequest pagingRequest,
@AuthenticationPrincipal JwtUser jwtUser
) {
throw new RuntimeException("Not implemented");
}

@Operation(summary = "완료한 챌린지 조회", description = "완료한 챌린지 페이징 조회한다.")
@GetMapping("/api/user/challenges/completes")
public ApiResponse<PagingResponse<ChallengeRes.ChallengeCompleteDto>> getChallengeCompletesPaging(
@Valid PagingRequest pagingRequest,
@AuthenticationPrincipal JwtUser jwtUser
) {
throw new RuntimeException("Not implemented");
}
}
Loading

0 comments on commit 54d8ea0

Please sign in to comment.