import uuid from datetime import datetime, timezone from sqlalchemy import DateTime, Integer, String from sqlalchemy.orm import Mapped, mapped_column from app.db 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(32), unique=True, index=True) password_hash: Mapped[str] = mapped_column(String(255)) email: Mapped[str | None] = mapped_column(String(255), nullable=True) # NOTE: owned by Workstream B in the character-depth-ghost-log spec # (docs/superpowers/specs/2026-07-23-character-depth-ghost-log-design.md). # Added here so Workstream C (unlocks/items/sigils/drops) can build and # test against it in isolation; the merge controller reconciles this # against Workstream B's own edit to this file (which will also add # `favor: float` per the spec's Contract section). essence: Mapped[int] = mapped_column(Integer, default=0) created_at: Mapped[datetime] = mapped_column( DateTime(timezone=True), default=lambda: datetime.now(timezone.utc) )