Skip to content

Commit

Permalink
[Feat]: api 변경 1차
Browse files Browse the repository at this point in the history
  • Loading branch information
bayy1216 committed May 30, 2024
1 parent 363aaf5 commit 1e85b83
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@Builder
public record PagingResponse<T>(
Integer totalPage,
Boolean hasNext,
List<T> data
) {

Expand All @@ -22,6 +23,7 @@ public static <Entity, Model> PagingResponse<Model> from(
) {
return PagingResponse.<Model>builder()
.totalPage(page.getTotalPages())
.hasNext(page.hasNext())
.data(page.getContent().stream().map(converter).toList())
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public ApiResponse<AuthRes.LoginResponse> 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)
)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public ApiResponse<PagingResponse<ChallengeRes.ChallengeDto>> getChallengeShorts
}

@Operation(summary = "진행중인 챌린지 조회", description = "진행중인 챌린지 조회한다.")
@GetMapping("/api/challenges/currents")
@GetMapping("/api/user/challenges/currents")
public ApiResponse<PagingResponse<ChallengeRes.ChallengeCurrentDto>> getChallengeCurrentsPaging(
@Valid PagingRequest pagingRequest,
@AuthenticationPrincipal JwtUser jwtUser
Expand All @@ -72,7 +72,7 @@ public ApiResponse<PagingResponse<ChallengeRes.ChallengeCurrentDto>> getChalleng
}

@Operation(summary = "완료한 챌린지 조회", description = "완료한 챌린지 페이징 조회한다.")
@GetMapping("/api/challenges/completes")
@GetMapping("/api/user/challenges/completes")
public ApiResponse<PagingResponse<ChallengeRes.ChallengeCompleteDto>> getChallengeCompletesPaging(
@Valid PagingRequest pagingRequest,
@AuthenticationPrincipal JwtUser jwtUser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public record ChallengeDetailDto(
LocalDate endDate,
ChallengeCategory category,
/////
List<String> imageUrl,
Integer maxDifficulty,
List<String> imageUrls,
List<ChallengeDifficultyDto> difficulties
) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
@RestController
public class ChallengeInteractController {

@Operation(summary = "챌린지 참여", description = "챌린지에 참여한다.")
@Operation(summary = "챌린지 인증", description = "챌린지에 인증한다.")
@PostMapping("/api/challenges/{challengeId}/verification")
public ApiResponse<ChallengeInteractRes.ChallengeVerificationResponse> challengeVerification(
@PathVariable Long challengeId,
@RequestPart("content") ChallengeInteractReq.ChallengeVerificationRequest request,
@RequestPart("body") ChallengeInteractReq.ChallengeVerificationRequest request,
@RequestPart("image") MultipartFile image
) {
throw new RuntimeException("Not implemented");
Expand All @@ -47,9 +47,8 @@ public ApiResponse<ChallengeInteractRes.ChallengeRecordResponse> getChallengeRec
}

@Operation(summary = "챌린지 기록 상세 조회", description = "챌린지 기록 상세를 조회한다.")
@GetMapping("/api/challenges/{challengeId}/record/{recordId}")
@GetMapping("/api/challenges/record/{recordId}")
public ApiResponse<ChallengeInteractRes.ChallengeRecordDetailDto> getChallengeRecordDetail(
@PathVariable Long challengeId,
@PathVariable Long recordId,
@AuthenticationPrincipal JwtUser jwtUser
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public record ChallengeRecordResponse(
Integer successCount,
LocalDate startDate,
LocalDate endDate,
List<Long> recordDetailIds
List<Long> recordIds
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public ApiResponse<UserRes.UserInfoDto> getUserInfo(
) {
return ApiResponse.success(
new UserRes.UserInfoDto(1L, "nickname", "profileImageUrl", "email",
new UserRes.TierDto("tier", 100, 50)
new UserRes.TierInfoDto("tier", 100, 50)
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public record UserInfoDto(
String nickname,
String profileImageUrl,
String email,
TierDto tier
TierInfoDto tierInfo
) {
}

Expand All @@ -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
Expand Down

0 comments on commit 1e85b83

Please sign in to comment.