"""User model for authentication.""" from typing import List, Optional from sqlalchemy import String, Boolean from sqlalchemy.orm import Mapped, mapped_column, relationship from tradingagents.api.models.base import Base, TimestampMixin class User(Base, TimestampMixin): """User model for authentication and authorization.""" __tablename__ = "users" id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) username: Mapped[str] = mapped_column(String(255), unique=True, nullable=False, index=True) email: Mapped[str] = mapped_column(String(255), unique=True, nullable=False, index=True) hashed_password: Mapped[str] = mapped_column(String(255), nullable=False) full_name: Mapped[Optional[str]] = mapped_column(String(255), nullable=True) is_active: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False) is_superuser: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False) # Relationship to strategies strategies: Mapped[List["Strategy"]] = relationship( "Strategy", back_populates="user", cascade="all, delete-orphan" ) def __repr__(self) -> str: return f""