Skip to content

Commit

Permalink
fix: 잘못된 메서드 네이밍 수정 #44
Browse files Browse the repository at this point in the history
  • Loading branch information
PgmJun committed Feb 8, 2024
1 parent 90f6af8 commit 09aa132
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import com.nice.petudio.api.controller.gift.dto.GiftGenerateResponse;
import com.nice.petudio.api.controller.ticket.service.TicketServiceUtils;
import com.nice.petudio.common.exception.error.ErrorCode;
import com.nice.petudio.common.exception.model.ValidationException;
import com.nice.petudio.domain.gift.Gift;
import com.nice.petudio.domain.gift.repository.GiftRepository;
import com.nice.petudio.domain.member.point.Ticket;
Expand Down Expand Up @@ -32,7 +30,7 @@ public GiftGenerateResponse generateGift(final Long memberId) {
}

public void useGift(final Long memberId, final String giftCode) {
Gift gift = GiftServiceUtils.findByGiftId(giftRepository, giftCode);
Gift gift = GiftServiceUtils.findByGiftCode(giftRepository, giftCode);
gift.use(memberId, LocalDateTime.now());

Ticket ticket = TicketServiceUtils.findTicketByMemberId(ticketRepository, memberId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class GiftServiceUtils {

public static Gift findByGiftId(GiftRepository giftRepository, final String giftCode) {
public static Gift findByGiftCode(GiftRepository giftRepository, final String giftCode) {
return giftRepository.findByGiftCode(giftCode)
.orElseThrow(() -> new NotFoundException(ErrorCode.NOT_FOUND_GIFT_EXCEPTION,
String.format("해당하는 GiftCode (%s)를 가진 Gift가 존재하지 않습니다.", giftCode)));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/nice/petudio/domain/gift/Gift.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void validateNotUsed() {
public void validateNotExpired(LocalDateTime now) {
if(isExpired(now)) {
throw new ValidationException(ErrorCode.EXPIRED_GIFT_EXCEPTION,
String.format("사용 기한이 만료된 기프트 (GIFT_ID: %d) 입니다."));
String.format("사용 기한이 만료된 기프트 (GIFT_ID: %d) 입니다.", this.id));
}
}

Expand Down

0 comments on commit 09aa132

Please sign in to comment.