Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

축제용 배포 #246

Merged
merged 4 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@Getter
@RequiredArgsConstructor
public enum Grade {

EVENT("EVENT", 0.0D),
ORDA("ORDA", 4.0D),
DEFAULT("Earlier", 6.3D);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.readyvery.readyverydemo.src.coupon.dto;

import java.time.LocalDateTime;
import java.util.List;

import org.springframework.stereotype.Component;
Expand All @@ -16,6 +17,7 @@ public CouponsRes toCouponsRes(List<Coupon> coupons) {
//filter로 isUsed가 false인 쿠폰만 가져옴
.coupons(coupons.stream()
.filter(coupon -> coupon.getIssueCount() - coupon.getUseCount() > 0)
.filter(coupon -> coupon.getCouponDetail().getExpire().isAfter(LocalDateTime.now()))
.map(this::toCouponDto)
.toList())
.build();
Expand All @@ -27,7 +29,6 @@ private CouponDto toCouponDto(Coupon coupon) {
.couponName(coupon.getCouponDetail().getName())
.description(coupon.getCouponDetail().getDescription())
.expirationDate(coupon.getCouponDetail().getExpire())
.leftCoupon(coupon.getIssueCount() - coupon.getUseCount())
.publisher(coupon.getCouponDetail().getStore() == null
? "레디베리" : coupon.getCouponDetail().getStore().getName())
.salePrice(coupon.getCouponDetail().getSalePrice())
Expand Down
Loading