Skip to content

Commit

Permalink
Fix: 쿠폰 볼 때 만료 안보이게 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
marinesnow34 authored May 16, 2024
1 parent 6ecaac9 commit efa0761
Showing 1 changed file with 2 additions and 1 deletion.
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

0 comments on commit efa0761

Please sign in to comment.