Add quantity column to GuestGifts table and update references
Introduced a `quantity` field to track the number of reserved gifts in the many-to-many GuestGifts table. Updated all related CRUD operations, models, and imports to reflect the added column. Replaced `guest_gifts` with `GuestGifts` for consistency in naming conventions.
This commit is contained in:
@@ -16,7 +16,7 @@ from .event_theme import EventTheme
|
||||
from .event_media import EventMedia, MediaType, MediaPurpose
|
||||
|
||||
# Import guest and RSVP models
|
||||
from .guest import Guest, GuestStatus, guest_gifts
|
||||
from .guest import Guest, GuestStatus, GuestGifts
|
||||
from .rsvp import RSVP, RSVPStatus
|
||||
|
||||
# Import gift-related models
|
||||
|
||||
@@ -82,11 +82,12 @@ class Guest(Base, UUIDMixin, TimestampMixin):
|
||||
|
||||
|
||||
# Association table for guest gifts (many-to-many relationship)
|
||||
guest_gifts = Table(
|
||||
GuestGifts = Table(
|
||||
'guest_gifts',
|
||||
Base.metadata,
|
||||
Column('guest_id', UUID(as_uuid=True), ForeignKey('guests.id'), primary_key=True),
|
||||
Column('gift_id', UUID(as_uuid=True), ForeignKey('gift_items.id'), primary_key=True),
|
||||
Column('reserved_at', DateTime(timezone=True), default=lambda: datetime.now(timezone.utc)),
|
||||
Column('notes', String),
|
||||
Column('quantity', Integer, default=1),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user