From d56a0d3baa168f0579a2560cd59971dd4fe1d414 Mon Sep 17 00:00:00 2001 From: Felipe Cardoso Date: Sun, 16 Mar 2025 21:07:56 +0100 Subject: [PATCH] fix reserve gifts endpoint --- backend/app/crud/gift.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/app/crud/gift.py b/backend/app/crud/gift.py index d77b64b..9d590ae 100644 --- a/backend/app/crud/gift.py +++ b/backend/app/crud/gift.py @@ -92,7 +92,7 @@ class CRUDGiftItem(CRUDBase[GiftItem, GiftItemCreate, GiftItemUpdate]): """Reserve a gift for a guest with specified quantity""" gift: GiftItem = self.get(db, gift_id) - if gift and gift.status == GiftStatus.AVAILABLE: + if gift and gift.quantity_received < gift.quantity_requested: # Add to the association table using the SQLAlchemy Core Table directly from app.models.guest import guest_gifts