feat(local_backend): reservations, print analytics, workday summary, zone-PIN management

- 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>
This commit is contained in:
2026-06-07 20:25:22 +03:00
parent aed71a18d8
commit 79bd3b0f41
25 changed files with 2017 additions and 146 deletions

View File

@@ -0,0 +1,42 @@
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])