"""Settings model — singleton row for app-wide configuration.""" from datetime import datetime, timezone from sqlalchemy import Integer, Text from sqlalchemy.orm import Mapped, mapped_column from app.db import Base class Settings(Base): """ Singleton settings row (id=1). Stores the hashed password and app-level config. password_hash is NULL until first-run setup. """ __tablename__ = "settings" id: Mapped[int] = mapped_column(Integer, primary_key=True, default=1) password_hash: Mapped[str | None] = mapped_column(Text, nullable=True, default=None) created_at: Mapped[str] = mapped_column( Text, default=lambda: datetime.now(timezone.utc).isoformat(), ) updated_at: Mapped[str] = mapped_column( Text, default=lambda: datetime.now(timezone.utc).isoformat(), onupdate=lambda: datetime.now(timezone.utc).isoformat(), )