Paperjet/backend/app/models/settings.py
Elijah c545d4b17d
Some checks failed
Automated Container Build / build-and-push (push) Failing after 3s
CI / Backend (Python) (push) Failing after 28s
CI / Frontend (TypeScript) (push) Failing after 5m8s
Initial commit with Phase 0 Scaffolding
2026-06-10 18:28:17 -07:00

31 lines
917 B
Python

"""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(),
)