-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from CoolPeace-yanolza/develop
01-22 16시 배포
- Loading branch information
Showing
12 changed files
with
178 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/com/coolpeace/domain/coupon/controller/CouponSearchController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.coolpeace.domain.coupon.controller; | ||
|
||
import com.coolpeace.domain.coupon.dto.request.SearchCouponParams; | ||
import com.coolpeace.domain.coupon.dto.response.CouponCategoryResponse; | ||
import com.coolpeace.domain.coupon.dto.response.CouponResponse; | ||
import com.coolpeace.domain.coupon.dto.response.CouponSearchResponse; | ||
import com.coolpeace.domain.coupon.service.CouponService; | ||
import com.coolpeace.global.jwt.security.JwtPrincipal; | ||
import com.coolpeace.global.resolver.AuthJwtPrincipal; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.web.PageableDefault; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
public class CouponSearchController { | ||
private final CouponService couponService; | ||
|
||
@GetMapping("/v1/accommodations/{accommodation_id}/coupons") | ||
public ResponseEntity<CouponSearchResponse> searchCoupons( | ||
@PathVariable("accommodation_id") Long accommodationId, | ||
@Valid SearchCouponParams searchCouponParams, | ||
@PageableDefault Pageable pageable, | ||
@AuthJwtPrincipal JwtPrincipal jwtPrincipal | ||
) { | ||
Page<CouponResponse> couponResponses = couponService.searchCoupons( | ||
Long.valueOf(jwtPrincipal.getMemberId()), accommodationId, searchCouponParams, pageable); | ||
CouponCategoryResponse categoryResponse = couponService.getCouponCategories(); | ||
return ResponseEntity.ok(CouponSearchResponse.from(couponResponses, categoryResponse)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/coolpeace/domain/coupon/entity/type/CouponUseDaysType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.coolpeace.domain.coupon.entity.type; | ||
|
||
import com.coolpeace.global.common.ValuedEnum; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum CouponUseDaysType implements ValuedEnum { | ||
MONDAY("월"), | ||
TUESDAY("화"), | ||
WEDNESDAY("수"), | ||
THURSDAY("목"), | ||
FRIDAY("금"), | ||
SATURDAY("토"), | ||
SUNDAY("일"), | ||
WEEKDAY("평일"), | ||
WEEKEND("주말"), | ||
ALL("전체"); | ||
|
||
private final String value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.