Skip to content

Commit

Permalink
style: 중복 메서드 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
kmebin committed Nov 26, 2023
1 parent ec2043d commit f345bae
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void delete(AuthMember admin, Long couponId) {

@Transactional
public void use(Long memberId, Long couponWalletId) {
Coupon coupon = getByWallet(memberId, couponWalletId);
Coupon coupon = getByWalletIdAndMemberId(couponWalletId, memberId);
couponRepository.delete(coupon);
}

Expand All @@ -71,12 +71,6 @@ public CouponResponse getById(Long couponId) {
return CouponMapper.toResponse(coupon);
}

public Coupon getByWallet(Long memberId, Long couponWalletId) {
return couponWalletRepository.findByIdAndMemberId(couponWalletId, memberId)
.orElseThrow(() -> new NotFoundException(ErrorMessage.NOT_FOUND_COUPON_WALLET))
.getCoupon();
}

public List<CouponResponse> getAllByStatus(CouponStatusRequest request) {
LocalDate now = clockHolder.date();
List<Coupon> coupons = couponSearchRepository.findAllByStatus(now, request);
Expand Down

0 comments on commit f345bae

Please sign in to comment.