From 3acb880fc5f8466131028391763684ad492f8904 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Sun, 12 Jul 2026 12:37:47 +0000 Subject: [PATCH] Add Kitchen SQLAlchemy model to models/user.py settings.py imports Kitchen for the back-reference relationship on KitchenSettings.kitchen. KDS uses kitchen_db directly so the table exists; this minimal model satisfies the import without pulling in kitchen-only models. Co-Authored-By: Claude Sonnet 4.6 --- backend/models/user.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/backend/models/user.py b/backend/models/user.py index 5b95ebe..a06df6f 100644 --- a/backend/models/user.py +++ b/backend/models/user.py @@ -1,11 +1,28 @@ """ -Type stub — kds.py has `from models.user import User` for the type annotation on -Depends(get_current_user). At runtime the dependency returns a SimpleNamespace from -auth.py; this class satisfies the import without pulling in the full SQLAlchemy model. +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: + """Type stub for Depends(get_current_user) annotations — runtime is a SimpleNamespace.""" id: int email: str name: str