fix reserve gifts endpoint
This commit is contained in:
@@ -92,7 +92,7 @@ class CRUDGiftItem(CRUDBase[GiftItem, GiftItemCreate, GiftItemUpdate]):
|
|||||||
"""Reserve a gift for a guest with specified quantity"""
|
"""Reserve a gift for a guest with specified quantity"""
|
||||||
|
|
||||||
gift: GiftItem = self.get(db, gift_id)
|
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
|
# Add to the association table using the SQLAlchemy Core Table directly
|
||||||
from app.models.guest import guest_gifts
|
from app.models.guest import guest_gifts
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user