Skip to content

Commit c9c03b2

Browse files
committed
feat: 랭킹 API page/size 파라미터 유효성 검증 추가
1 parent d5117fb commit c9c03b2

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

apps/commerce-api/src/main/java/com/loopers/interfaces/api/ranking/RankingV1Controller.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
import com.loopers.application.ranking.RankingInfo.RankingPageInfo;
55
import com.loopers.interfaces.api.ApiResponse;
66
import com.loopers.interfaces.api.ranking.RankingV1Dto.RankingPageResponse;
7+
import jakarta.validation.constraints.Max;
8+
import jakarta.validation.constraints.Min;
79
import lombok.RequiredArgsConstructor;
10+
import org.springframework.validation.annotation.Validated;
811
import org.springframework.web.bind.annotation.*;
912

13+
@Validated
1014
@RequiredArgsConstructor
1115
@RestController
1216
@RequestMapping("/api/v1")
@@ -23,8 +27,8 @@ public class RankingV1Controller {
2327
@GetMapping("/rankings")
2428
public ApiResponse<RankingPageResponse> getRankings(
2529
@RequestParam(value = "date", required = false) String date,
26-
@RequestParam(value = "page", defaultValue = "1") int page,
27-
@RequestParam(value = "size", defaultValue = "20") int size
30+
@RequestParam(value = "page", defaultValue = "1") @Min(1) int page,
31+
@RequestParam(value = "size", defaultValue = "20") @Min(1) @Max(100) int size
2832
) {
2933
// API는 1-based, 내부는 0-based로 변환
3034
int zeroBasedPage = Math.max(0, page - 1);

0 commit comments

Comments
 (0)