2026-02-09 15:49:50 +05:30
|
|
|
"""User model storing identity and profile preferences."""
|
|
|
|
|
|
2026-02-04 02:28:51 +05:30
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from uuid import UUID, uuid4
|
|
|
|
|
|
2026-02-09 02:04:14 +05:30
|
|
|
from sqlmodel import Field
|
2026-02-04 02:28:51 +05:30
|
|
|
|
2026-02-09 02:04:14 +05:30
|
|
|
from app.models.base import QueryModel
|
2026-02-04 02:28:51 +05:30
|
|
|
|
2026-02-09 02:04:14 +05:30
|
|
|
|
|
|
|
|
class User(QueryModel, table=True):
|
2026-02-09 15:49:50 +05:30
|
|
|
"""Application user account and profile attributes."""
|
|
|
|
|
|
2026-02-09 20:40:17 +05:30
|
|
|
__tablename__ = "users" # pyright: ignore[reportAssignmentType]
|
2026-02-04 02:28:51 +05:30
|
|
|
|
|
|
|
|
id: UUID = Field(default_factory=uuid4, primary_key=True)
|
|
|
|
|
clerk_user_id: str = Field(index=True, unique=True)
|
|
|
|
|
email: str | None = Field(default=None, index=True)
|
|
|
|
|
name: str | None = None
|
2026-02-04 20:21:33 +05:30
|
|
|
preferred_name: str | None = None
|
|
|
|
|
pronouns: str | None = None
|
|
|
|
|
timezone: str | None = None
|
|
|
|
|
notes: str | None = None
|
|
|
|
|
context: str | None = None
|
2026-02-04 02:28:51 +05:30
|
|
|
is_super_admin: bool = Field(default=False)
|
2026-02-08 21:16:26 +05:30
|
|
|
active_organization_id: UUID | None = Field(
|
2026-02-09 15:49:50 +05:30
|
|
|
default=None,
|
|
|
|
|
foreign_key="organizations.id",
|
|
|
|
|
index=True,
|
2026-02-08 21:16:26 +05:30
|
|
|
)
|