"""User ORM model.""" from __future__ import annotations from typing import TYPE_CHECKING from sqlalchemy import Boolean, String from sqlalchemy.orm import Mapped, mapped_column, relationship from app.models.base import Base, TimestampMixin, UUIDMixin if TYPE_CHECKING: from app.models.machine import Machine class User(UUIDMixin, TimestampMixin, Base): __tablename__ = "users" email: Mapped[str] = mapped_column(String(320), unique=True, index=True, nullable=False) hashed_password: Mapped[str] = mapped_column(String(255), nullable=False) full_name: Mapped[str | None] = 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) machines: Mapped[list[Machine]] = relationship( back_populates="owner", cascade="all, delete-orphan", lazy="selectin", ) def __repr__(self) -> str: # pragma: no cover return f""