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 <noreply@anthropic.com>
This commit is contained in:
parent
32e13d6d49
commit
3acb880fc5
1 changed files with 20 additions and 3 deletions
|
|
@ -1,11 +1,28 @@
|
||||||
"""
|
"""
|
||||||
Type stub — kds.py has `from models.user import User` for the type annotation on
|
Minimal SQLAlchemy models for KDS. KDS uses kitchen_db directly so these
|
||||||
Depends(get_current_user). At runtime the dependency returns a SimpleNamespace from
|
tables already exist — these definitions just allow relationship navigation.
|
||||||
auth.py; this class satisfies the import without pulling in the full SQLAlchemy model.
|
|
||||||
"""
|
"""
|
||||||
|
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:
|
class User:
|
||||||
|
"""Type stub for Depends(get_current_user) annotations — runtime is a SimpleNamespace."""
|
||||||
id: int
|
id: int
|
||||||
email: str
|
email: str
|
||||||
name: str
|
name: str
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue