- New reservations module: model, schema, router (CRUD + status updates + upcoming alerts) and background task for auto-expiring stale reservations - Reports: print_products, print_categories, print_tables analytics endpoints plus meta_products and business_day_summary for workday close/view flow - printer_service: configurable font sizes/weights, donut/bar chart print layout helpers, analytics print blocks per printer - tables/schemas: surfaced color, zone, and other new fields on Table, Product, User, Printer - demo_seed.py for quick dev DB population; wipe_database.py utility Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Text
|
|
from sqlalchemy.orm import relationship
|
|
from datetime import datetime, timezone
|
|
from database import Base
|
|
|
|
|
|
class Reservation(Base):
|
|
__tablename__ = "reservations"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
|
|
# Guest info
|
|
guest_name = Column(String, nullable=False)
|
|
party_size = Column(Integer, nullable=False)
|
|
phone = Column(String, nullable=True)
|
|
email = Column(String, nullable=True)
|
|
note = Column(Text, nullable=True)
|
|
|
|
# When the customer wants the table
|
|
reserved_for = Column(DateTime, nullable=False)
|
|
|
|
# Optional table assignment (assignable/editable later)
|
|
table_id = Column(Integer, ForeignKey("tables.id"), nullable=True)
|
|
|
|
# Lifecycle: pending | arrived | cancelled | no_show
|
|
status = Column(String, nullable=False, default="pending")
|
|
|
|
# Source: manager_app | waiter_app | online
|
|
source = Column(String, nullable=False, default="manager_app")
|
|
|
|
# Who entered this reservation (staff user)
|
|
created_by_user_id = Column(Integer, ForeignKey("users.id"), nullable=True)
|
|
|
|
# For future online reservations: cloud-side customer identifier
|
|
online_customer_id = Column(String, nullable=True)
|
|
|
|
created_at = Column(DateTime, default=lambda: datetime.now(timezone.utc))
|
|
updated_at = Column(DateTime, default=lambda: datetime.now(timezone.utc),
|
|
onupdate=lambda: datetime.now(timezone.utc))
|
|
|
|
table = relationship("Table", foreign_keys=[table_id])
|
|
created_by = relationship("User", foreign_keys=[created_by_user_id])
|