Includes all work to date: - local_backend: FastAPI backend with products, orders, tables, shifts, cloud sync - manager_dashboard: React manager UI with product/category management, reports, settings - waiter_pwa: React PWA for waiter devices - Category reparent endpoint and UI - Waiter domain: local_ip sent on heartbeat, waiter_domain persisted from cloud response - QR code modal in AppInfoTab for waiter domain - Product form: number input spinners removed, category pre-selected on new product - Category row: count badge moved to far right Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
25 lines
968 B
Python
25 lines
968 B
Python
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Text
|
|
from sqlalchemy.orm import relationship
|
|
from datetime import datetime, timezone
|
|
from database import Base
|
|
|
|
|
|
def _utcnow():
|
|
return datetime.now(timezone.utc)
|
|
|
|
|
|
class BusinessDay(Base):
|
|
__tablename__ = "business_days"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
status = Column(String, default="open", nullable=False) # 'open' | 'closed'
|
|
opened_at = Column(DateTime(timezone=True), default=_utcnow, nullable=False)
|
|
opened_by_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
closed_at = Column(DateTime(timezone=True), nullable=True)
|
|
closed_by_id = Column(Integer, ForeignKey("users.id"), nullable=True)
|
|
notes = Column(Text, nullable=True)
|
|
|
|
opener = relationship("User", foreign_keys=[opened_by_id])
|
|
closer = relationship("User", foreign_keys=[closed_by_id])
|
|
shifts = relationship("WaiterShift", back_populates="business_day")
|