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

✏️ 쿠폰 QA 후 문제점 수정 #63

Merged
merged 2 commits into from
Jan 16, 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 @@ -27,7 +27,7 @@ public List<CouponForOwnerDto> readCouponsForOwner(Long storeId, LocalDate now)
}

public List<Coupon> readStoresAllValidateCoupon(Long storeId, LocalDate now) {
return couponRepository.findAllDownloadableCouponsByStoreId(storeId, now);
return couponRepository.findAllValidateCouponsByStoreId(storeId, now);
}

public List<CouponWithIssueStatusDto> readStoreCouponsForUser(Long userId, Long storeId, LocalDate now) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public interface CouponRepositoryCustom {
List<CouponForOwnerDto> findAllDtoByStoreId(Long storeId, LocalDate now);
List<Coupon> findAllDownloadableCouponsByStoreId(Long storeId, LocalDate now);
List<Coupon> findAllValidateCouponsByStoreId(Long storeId, LocalDate now);
List<CouponWithIssueStatusDto> findStoreCouponsForUser(Long userId, Long storeId, LocalDate now);
List<CouponWithAvailabilityDto> findAvailableCoupons(Long totalAmount, Long userId, Long storeId, LocalDate now);
List<CouponDto> findMyValidCoupons(Long userId, LocalDate now);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public List<CouponForOwnerDto> findAllDtoByStoreId(Long storeId, LocalDate now)
coupon.endDate
))
.from(coupon)
.leftJoin(issuedCoupon)
.on(coupon.id.eq(issuedCoupon.id.couponId))
.where(
coupon.store.id.eq(storeId),
coupon.isDeleted.isFalse(),
Expand All @@ -50,14 +48,11 @@ public List<CouponForOwnerDto> findAllDtoByStoreId(Long storeId, LocalDate now)
}

@Override
public List<Coupon> findAllDownloadableCouponsByStoreId(Long storeId, LocalDate now) {
public List<Coupon> findAllValidateCouponsByStoreId(Long storeId, LocalDate now) {
return queryFactory
.selectFrom(coupon)
.leftJoin(issuedCoupon)
.on(issuedCoupon.coupon.id.eq(coupon.id))
.where(
coupon.store.id.eq(storeId),
issuedCoupon.id.isNull(),
isCouponUnexpired(now),
coupon.isDeleted.isFalse()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ void readMyValidCouponCount() {
assertThat(result).isEqualTo(1);
}

@DisplayName("현재 다운받을 수 있는 쿠폰 목록을 반환한다")
@DisplayName("현재 가게의 유효한 쿠폰 목록을 반환한다")
@Test
void readStoresAllValidateCoupon() {
// given
Expand All @@ -359,8 +359,8 @@ void readStoresAllValidateCoupon() {
List<Coupon> result = couponReader.readStoresAllValidateCoupon(s1.getId(), now.plusDays(3));

// then
assertThat(result).hasSize(1)
.containsExactly(c1);
assertThat(result).hasSize(3)
.containsExactly(c1,c2,c3);


}
Expand Down
Loading