fix(gift): 수취인 정보 없는 선물의 전달 완료를 차단한다

This commit is contained in:
2026-10-02 20:06:17 +09:00
parent c6b5f9c867
commit 0bbb9e4fc7
4 changed files with 74 additions and 4 deletions
@@ -84,4 +84,11 @@ class GiftDelivery(
@Column(name = "undeliverable_reason", length = 255)
var undeliverableReason: String? = null
) : BaseEntity()
) : BaseEntity() {
fun hasCompleteRecipientInformation() = listOf(
recipientName,
recipientPhoneNumber,
recipientZipCode,
recipientAddress
).none { it.isNullOrBlank() }
}
@@ -203,6 +203,7 @@ class GiftAdminService(
val gift = giftRepository.findByApplicationNo(applicationNo) ?: throw invalidRequest()
if (gift.status != GiftStatus.INSPECTION_COMPLETED) throw invalidRequest()
val delivery = giftDeliveryRepository.findByGiftId(requireNotNull(gift.id)) ?: throw invalidRequest()
if (!delivery.hasCompleteRecipientInformation()) throw invalidRequest()
gift.status = GiftStatus.DELIVERED
delivery.deliveredAt = now