Update gift cancellation to include received status
Allow cancellation of gifts with a status of either RESERVED or RECEIVED. This ensures consistency in handling gift statuses during reservation management across the application.
This commit is contained in:
@@ -136,7 +136,7 @@ class CRUDGiftItem(CRUDBase[GiftItem, GiftItemCreate, GiftItemUpdate]):
|
||||
raise ValueError(f"Guest with ID {guest_id} not found")
|
||||
|
||||
# Only perform the operation if the gift is reserved
|
||||
if gift.status == GiftStatus.RESERVED:
|
||||
if gift.status in [GiftStatus.RESERVED, GiftStatus.RECEIVED]:
|
||||
# Check if this guest has actually reserved this gift
|
||||
if guest in gift.reserved_by:
|
||||
gift.reserved_by.remove(guest)
|
||||
|
||||
Reference in New Issue
Block a user