Make User a proper SQLAlchemy model so kds_course_bumps FK resolves

kds_course_bumps.bumped_by_user_id references users.id — SQLAlchemy needs
the User model in Base.metadata to resolve this at startup. Route handlers
still receive a SimpleNamespace from auth.py at runtime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-12 12:38:47 +00:00
parent 3acb880fc5
commit cd434b3a19

View file

@ -21,11 +21,13 @@ class Kitchen(Base):
) )
class User: class User(Base):
"""Type stub for Depends(get_current_user) annotations — runtime is a SimpleNamespace.""" """Minimal SQLAlchemy model so FKs referencing users.id resolve at startup.
id: int Route handlers receive a SimpleNamespace from auth.py at runtime, not instances
email: str of this class this definition exists only for SQLAlchemy FK resolution."""
name: str __tablename__ = "users"
is_admin: bool
kitchen_id: int id: Mapped[int] = mapped_column(primary_key=True, index=True)
caps: list 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)