""" Minimal SQLAlchemy models for KDS. KDS uses kitchen_db directly so these tables already exist — these definitions just allow relationship navigation. """ from datetime import datetime from sqlalchemy import String, DateTime from sqlalchemy.orm import Mapped, mapped_column, relationship from database import Base class Kitchen(Base): __tablename__ = "kitchens" id: Mapped[int] = mapped_column(primary_key=True, index=True) name: Mapped[str] = mapped_column(String(255), nullable=False) created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow) settings: Mapped["KitchenSettings"] = relationship( "KitchenSettings", back_populates="kitchen", uselist=False ) class User(Base): """Minimal SQLAlchemy model so FKs referencing users.id resolve at startup. Route handlers receive a SimpleNamespace from auth.py at runtime, not instances of this class — this definition exists only for SQLAlchemy FK resolution.""" __tablename__ = "users" id: Mapped[int] = mapped_column(primary_key=True, index=True) email: Mapped[str] = mapped_column(String(255), nullable=False) name: Mapped[str | None] = mapped_column(String(255), nullable=True) is_admin: Mapped[bool] = mapped_column(default=False)