Skip to content

Commit

Permalink
Merge pull request #245 from marinesnow34/test
Browse files Browse the repository at this point in the history
Fix: 쿠폰 볼 때 만료 안보이게 수정
  • Loading branch information
marinesnow34 authored May 16, 2024
2 parents 4728b71 + efa0761 commit 28de5fb
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 28de5fb

Please sign in to comment.