Skip to content

Commit

Permalink
[Feat]: 더미데이터 출력
Browse files Browse the repository at this point in the history
  • Loading branch information
bayy1216 committed May 30, 2024
1 parent d6e6b2b commit dde83e1
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class AuthController {
public ApiResponse<AuthRes.LoginResponse> 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)
)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@
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;
import org.springframework.web.bind.annotation.PathVariable;
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
Expand All @@ -23,45 +28,113 @@ public class ChallengeGroupController {
@Operation(summary = "챌린지 그룹 목록 페이징", description = "챌린지 그룹 페이징 조회.")
@GetMapping("/api/challengeGroups")
public ApiResponse<PagingResponse<ChallengeGroupRes.ChallengeGroupDto>> getChallengesPaging(
@Valid PagingRequest pagingRequest,
@RequestParam ChallengeCategory category
@Valid PagingRequest pagingRequest,
@RequestParam ChallengeCategory category
) {
throw new RuntimeException("Not implemented");
return ApiResponse.success(PagingResponse.<ChallengeGroupRes.ChallengeGroupDto>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<ChallengeGroupRes.ChallengeGroupDetailDto> 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<PagingResponse<ChallengeGroupRes.ChallengeReviewDto>> getChallengeReviews(
@Valid PagingRequest pagingRequest
@Valid PagingRequest pagingRequest
) {
throw new RuntimeException("Not implemented");
return ApiResponse.success(
PagingResponse.<ChallengeGroupRes.ChallengeReviewDto>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<ChallengeGroupRes.ChallengeGroupRankingPagingResponse> 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<PagingResponse<ChallengeGroupRes.ChallengeGroupDto>> getChallengeShortsPaging(
@RequestParam Long page
@RequestParam Long page
) {
throw new RuntimeException("Not implemented");
return ApiResponse.success(
PagingResponse.<ChallengeGroupRes.ChallengeGroupDto>builder()
.hasNext(false)
.totalPage(1)
.data(List.of(
new ChallengeGroupRes.ChallengeGroupDto(1L,
"title", "thumbnailUrl", 12,
LocalDate.now(), LocalDate.now(), ChallengeCategory.VOLUNTEER)
))
.build()
);

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public ApiResponse<UserRes.UserInfoDto> 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)
)
);
Expand Down

0 comments on commit dde83e1

Please sign in to comment.