Private
Public Access
Four preset color themes, switchable from Profile settings with instant preview and server-side persistence (User.theme, applied via a data-theme attribute the CSS custom-property overrides in themes.css key off). Dark stays the existing DarkSingularity palette and default. Light is a genuine new light-mode design; Midnight is a higher-contrast OLED-friendly dark variant; Sunset swaps in a warm amber/coral accent family. Custom theme building (pick-your-own-colors) is out of scope for this pass -- presets only. Also: fixed the PATCH /api/auth/me handler to only apply fields actually present in the request body. It previously always overwrote display_name unconditionally, which happened to be harmless when it was the only field on ProfileUpdate but would have silently cleared it on any theme-only update. And switched two hardcoded hex colors (.btn-primary:hover, .role-badge-admin) to token-derived color-mix() values so they adapt across themes instead of staying fixed to the original cyan/violet palette. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
27 lines
1.2 KiB
Python
27 lines
1.2 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import Boolean, DateTime, String, func
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.models.base import Base
|
|
|
|
|
|
class User(Base):
|
|
__tablename__ = "users"
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(primary_key=True, default=uuid.uuid4)
|
|
username: Mapped[str] = mapped_column(String(50), unique=True, index=True, nullable=False)
|
|
email: Mapped[str] = mapped_column(String(255), unique=True, index=True, nullable=False)
|
|
password_hash: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
is_bot: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
|
is_site_admin: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
|
display_name: Mapped[str | None] = mapped_column(String(50))
|
|
theme: Mapped[str | None] = mapped_column(String(20))
|
|
avatar_filename: Mapped[str | None] = mapped_column(String(64))
|
|
avatar_content_type: Mapped[str | None] = mapped_column(String(50))
|
|
created_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), server_default=func.now(), nullable=False
|
|
)
|