fix reserve gifts endpoint

This commit is contained in:
2025-03-16 21:07:56 +01:00
parent 0a642581e8
commit d56a0d3baa

View File

@@ -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