diff --git a/src/main/java/org/swmaestro/repl/gifthub/vouchers/entity/Voucher.java b/src/main/java/org/swmaestro/repl/gifthub/vouchers/entity/Voucher.java index 22085bae..639cf358 100644 --- a/src/main/java/org/swmaestro/repl/gifthub/vouchers/entity/Voucher.java +++ b/src/main/java/org/swmaestro/repl/gifthub/vouchers/entity/Voucher.java @@ -67,4 +67,8 @@ public Voucher(Long id, Brand brand, Product product, String barcode, Integer ba this.user = user; this.imageUrl = imageUrl; } + + public boolean isDeleted() { + return deletedAt != null; + } } \ No newline at end of file diff --git a/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherService.java b/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherService.java index 54d3d643..5b435d79 100644 --- a/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherService.java +++ b/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherService.java @@ -108,6 +108,9 @@ public VoucherReadResponseDto read(Long id, String username) { if (!vouchers.contains(voucher.get())) { throw new BusinessException("상품권을 조회할 권한이 없습니다.", StatusEnum.FORBIDDEN); } + if (voucher.get().isDeleted()) { + throw new BusinessException("삭제된 상품권 입니다.", StatusEnum.BAD_REQUEST); + } VoucherReadResponseDto voucherReadResponseDto = mapToDto(voucher.get()); return voucherReadResponseDto;