From efa07619ff22c2d31d37d8b812e1c607f0fe82bb Mon Sep 17 00:00:00 2001 From: Joowon Lim Date: Fri, 17 May 2024 01:44:25 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=BF=A0=ED=8F=B0=20=EB=B3=BC=20?= =?UTF-8?q?=EB=95=8C=20=EB=A7=8C=EB=A3=8C=20=EC=95=88=EB=B3=B4=EC=9D=B4?= =?UTF-8?q?=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../readyvery/readyverydemo/src/coupon/dto/CouponMapper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/readyvery/readyverydemo/src/coupon/dto/CouponMapper.java b/src/main/java/com/readyvery/readyverydemo/src/coupon/dto/CouponMapper.java index ad1ac60..f46fba4 100644 --- a/src/main/java/com/readyvery/readyverydemo/src/coupon/dto/CouponMapper.java +++ b/src/main/java/com/readyvery/readyverydemo/src/coupon/dto/CouponMapper.java @@ -1,5 +1,6 @@ package com.readyvery.readyverydemo.src.coupon.dto; +import java.time.LocalDateTime; import java.util.List; import org.springframework.stereotype.Component; @@ -16,6 +17,7 @@ public CouponsRes toCouponsRes(List 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(); @@ -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())