44import org .springframework .http .ResponseEntity ;
55import org .springframework .web .bind .annotation .DeleteMapping ;
66import org .springframework .web .bind .annotation .GetMapping ;
7+ import org .springframework .web .bind .annotation .ModelAttribute ;
78import org .springframework .web .bind .annotation .PatchMapping ;
89import org .springframework .web .bind .annotation .PathVariable ;
910import org .springframework .web .bind .annotation .PostMapping ;
2526import com .threestar .trainus .domain .coupon .user .entity .CouponCategory ;
2627import com .threestar .trainus .domain .coupon .user .entity .CouponStatus ;
2728import com .threestar .trainus .global .annotation .LoginUser ;
29+ import com .threestar .trainus .global .dto .PageRequestDto ;
2830import com .threestar .trainus .global .unit .BaseResponse ;
2931import com .threestar .trainus .global .unit .PagedResponse ;
3032
3133import io .swagger .v3 .oas .annotations .Operation ;
3234import io .swagger .v3 .oas .annotations .tags .Tag ;
3335import jakarta .validation .Valid ;
34- import jakarta .validation .constraints .Max ;
35- import jakarta .validation .constraints .Min ;
3636import lombok .RequiredArgsConstructor ;
3737
3838@ Tag (name = "관리자 쿠폰 API" , description = "관리자 쿠폰 생성,수정 및 삭제 관련 API" )
@@ -56,15 +56,18 @@ public ResponseEntity<BaseResponse<CouponCreateResponseDto>> createCoupon(
5656 @ GetMapping
5757 @ Operation (summary = "쿠폰 목록 조회" , description = "관리자가 쿠폰 목록을 조회" )
5858 public ResponseEntity <PagedResponse <CouponListWrapperDto >> getCoupons (
59- @ RequestParam (defaultValue = "1" ) @ Min (value = 1 , message = "페이지는 1 이상이어야 합니다." )
60- @ Max (value = 1000 , message = "페이지는 1000 이하여야 합니다." ) int page ,
61- @ RequestParam (defaultValue = "5" ) @ Min (value = 1 , message = "limit는 1 이상이어야 합니다." )
62- @ Max (value = 100 , message = "limit는 100 이하여야 합니다." ) int limit ,
59+ @ Valid @ ModelAttribute PageRequestDto pageRequestDto ,
6360 @ RequestParam (required = false ) CouponStatus status ,
6461 @ RequestParam (required = false ) CouponCategory category ,
6562 @ LoginUser Long loginUserId
6663 ) {
67- CouponListResponseDto couponsInfo = adminCouponService .getCoupons (page , limit , status , category , loginUserId );
64+ CouponListResponseDto couponsInfo = adminCouponService .getCoupons (
65+ pageRequestDto .getPage (),
66+ pageRequestDto .getLimit (),
67+ status ,
68+ category ,
69+ loginUserId
70+ );
6871
6972 CouponListWrapperDto coupons = AdminCouponMapper .toCouponListWrapperDto (couponsInfo );
7073
0 commit comments