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:
@@ -916,7 +916,7 @@ def cancel_gift_reservation(
|
||||
raise HTTPException(status_code=404, detail="Gift item not found")
|
||||
|
||||
# Check if gift is reserved
|
||||
if gift.status != GiftStatus.RESERVED:
|
||||
if gift.status not in [GiftStatus.RESERVED, GiftStatus.RECEIVED]:
|
||||
raise HTTPException(status_code=400, detail="Gift is not currently reserved")
|
||||
|
||||
# Check if guest exists
|
||||
@@ -931,7 +931,7 @@ def cancel_gift_reservation(
|
||||
except ValueError as e:
|
||||
raise HTTPException(status_code=400, detail=str(e))
|
||||
|
||||
# Missing the return statement here, which is also a problem
|
||||
|
||||
return gift_item_crud.cancel_reservation(db, gift_id=item_id, guest_id=guest_id)
|
||||
|
||||
# ===== GIFT PURCHASES ===== #
|
||||
|
||||
Reference in New Issue
Block a user