fix(gift): 배송지 미입력 만료 상태 범위를 확장한다

This commit is contained in:
2026-10-02 20:08:05 +09:00
parent 112ad755e5
commit 124a615a85
3 changed files with 73 additions and 5 deletions
@@ -80,7 +80,11 @@ interface GiftRepository : JpaRepository<Gift, Long> {
"""
select g
from Gift g
where g.status = kr.co.vividnext.sodalive.v2.gift.domain.GiftStatus.TRACKING_REGISTERED
where g.status in (
kr.co.vividnext.sodalive.v2.gift.domain.GiftStatus.TRACKING_REGISTERED,
kr.co.vividnext.sodalive.v2.gift.domain.GiftStatus.ARRIVED_AT_MAILBOX,
kr.co.vividnext.sodalive.v2.gift.domain.GiftStatus.INSPECTION_COMPLETED
)
and exists (
select d.id
from GiftDelivery d
@@ -90,7 +94,7 @@ interface GiftRepository : JpaRepository<Gift, Long> {
)
"""
)
fun findTrackingRegisteredGiftsWithRecipientAddressDeadlineBefore(
fun findGiftsWithRecipientAddressDeadlineBefore(
@Param("now") now: LocalDateTime
): List<Gift>
@@ -51,7 +51,7 @@ class GiftScheduler(
@Transactional
fun markExpiredRecipientAddressGiftsUndeliverable(now: LocalDateTime): Int {
val expiredGifts = giftRepository.findTrackingRegisteredGiftsWithRecipientAddressDeadlineBefore(now)
val expiredGifts = giftRepository.findGiftsWithRecipientAddressDeadlineBefore(now)
expiredGifts.forEach { gift ->
gift.status = GiftStatus.UNDELIVERABLE
val delivery = requireNotNull(giftDeliveryRepository.findByGiftId(requireNotNull(gift.id)))