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 <noreply@anthropic.com>
31 lines
927 B
Python
31 lines
927 B
Python
"""
|
|
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
|
|
is_admin: bool
|
|
kitchen_id: int
|
|
caps: list
|