ab15c17ffb
- Users can pin/unpin any available service on their home page via a Customize mode; preferences persisted via PATCH /api/users/me/preferences - Time-aware greeting renders the user's display name through React JSX (HTML-escaped by design — no dangerouslySetInnerHTML used) - Added dashboard_app_ids JSON column to users table (migration c7e8f9a0b1d2) - /settings now routes to a placeholder page Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
import uuid
|
|
from typing import TYPE_CHECKING
|
|
|
|
from sqlalchemy import Boolean, JSON, String
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.database import Base
|
|
|
|
if TYPE_CHECKING:
|
|
from app.models.profile import Profile
|
|
|
|
|
|
class User(Base):
|
|
__tablename__ = "users"
|
|
|
|
id: Mapped[str] = mapped_column(String, primary_key=True, default=lambda: str(uuid.uuid4()))
|
|
email: Mapped[str] = mapped_column(String, unique=True, index=True, nullable=False)
|
|
hashed_password: Mapped[str] = mapped_column(String, nullable=False)
|
|
full_name: Mapped[str] = mapped_column(String, nullable=True)
|
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
# Role flag — True = admin, False = regular user.
|
|
# Never exposed in API responses; set only by direct DB or admin tooling.
|
|
is_superuser: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
# List of service IDs pinned to the user's home dashboard.
|
|
dashboard_app_ids: Mapped[list] = mapped_column(JSON, nullable=False, default=list)
|
|
|
|
profile: Mapped["Profile"] = relationship(
|
|
"Profile", back_populates="user", uselist=False, cascade="all, delete-orphan"
|
|
)
|