0591b00ded
Move models into domain subpackages (max 4 files each): - models/tool/ — tool_type, tool_instance, tool_definition_manifest - models/config/ — config_profile - models/user/ — user, user_config, ssh_key - models/project/ — project, git_repository, workspace - models/system/ — health_check, notification, instance_event, terminal_session models/__init__.py continues to re-export all symbols, so consumers using 'from src.models import X' are unaffected. Updated direct file imports across the backend to use the new paths. Quality gates: py_compile passed, ruff passed.
25 lines
961 B
Python
25 lines
961 B
Python
from typing import TYPE_CHECKING
|
|
|
|
from sqlalchemy import String
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from src.models.base import Base, TimestampMixin, UUIDPrimaryKeyMixin
|
|
|
|
if TYPE_CHECKING:
|
|
from src.models.project import Project
|
|
from src.models import SSHKey
|
|
from src.models import UserConfig
|
|
|
|
|
|
class User(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
|
__tablename__ = "users"
|
|
|
|
email: Mapped[str] = mapped_column(String(255), unique=True, index=True)
|
|
name: Mapped[str] = mapped_column(String(255))
|
|
authentik_id: Mapped[str] = mapped_column(String(255), unique=True, index=True)
|
|
avatar_url: Mapped[str | None] = mapped_column(String(1024), nullable=True)
|
|
|
|
projects: Mapped[list["Project"]] = relationship(back_populates="owner")
|
|
ssh_keys: Mapped[list["SSHKey"]] = relationship(back_populates="user")
|
|
user_config: Mapped["UserConfig | None"] = relationship(back_populates="user", uselist=False)
|