Remove all authentication (login, sessions, bcrypt, itsdangerous) since the app runs on a private homelab LAN. Replace with a profile picker landing page and cookie-based profile selection (1-year expiry). - Add Alembic migration to drop password_hash/is_admin columns - Delete auth service, auth routes, login template, and auth tests - Rewrite app/utils/auth.py with NoProfileSelectedError and require_active_profile dependency - Add profile creation flow (GET/POST /profiles/create) - Rewrite home page as profile picker with card layout - Update all route files to use profile dependency instead of admin auth - Remove bcrypt and itsdangerous from requirements - Remove admin_username/admin_password from config - Update all tests for new profile-based access model Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""User model for profile management.
|
|
|
|
Stores user profiles with physical stats and goals.
|
|
"""
|
|
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from sqlmodel import Field, SQLModel
|
|
|
|
|
|
class User(SQLModel, table=True):
|
|
"""A user profile in the system.
|
|
|
|
Attributes:
|
|
id: Primary key, auto-incremented.
|
|
username: Unique identifier.
|
|
display_name: Human-readable name shown in the UI.
|
|
height: User's height as a string (e.g., "6'0\"").
|
|
weight: User's weight as a string (e.g., "260 lbs").
|
|
goals: Free-text training goals.
|
|
created_at: Timestamp when the record was created.
|
|
updated_at: Timestamp of the last update.
|
|
"""
|
|
|
|
__tablename__ = "users"
|
|
|
|
id: Optional[int] = Field(default=None, primary_key=True)
|
|
username: str = Field(index=True, unique=True)
|
|
display_name: str = Field(default="")
|
|
height: Optional[str] = Field(default=None)
|
|
weight: Optional[str] = Field(default=None)
|
|
goals: Optional[str] = Field(default=None)
|
|
created_at: datetime = Field(default_factory=datetime.utcnow)
|
|
updated_at: datetime = Field(default_factory=datetime.utcnow)
|