chore: update generated files to orval v8.3.0 and adjust related interfaces
This commit is contained in:
@@ -17,6 +17,8 @@ from app.models.organization_members import OrganizationMember
|
||||
from app.models.organizations import Organization
|
||||
from app.models.task_dependencies import TaskDependency
|
||||
from app.models.task_fingerprints import TaskFingerprint
|
||||
from app.models.task_tag_assignments import TaskTagAssignment
|
||||
from app.models.task_tags import TaskTag
|
||||
from app.models.tasks import Task
|
||||
from app.models.users import User
|
||||
|
||||
@@ -39,5 +41,7 @@ __all__ = [
|
||||
"TaskDependency",
|
||||
"Task",
|
||||
"TaskFingerprint",
|
||||
"TaskTag",
|
||||
"TaskTagAssignment",
|
||||
"User",
|
||||
]
|
||||
|
||||
32
backend/app/models/task_tag_assignments.py
Normal file
32
backend/app/models/task_tag_assignments.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""Task/tag many-to-many link rows."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
from sqlalchemy import UniqueConstraint
|
||||
from sqlmodel import Field
|
||||
|
||||
from app.core.time import utcnow
|
||||
from app.models.base import QueryModel
|
||||
|
||||
RUNTIME_ANNOTATION_TYPES = (datetime,)
|
||||
|
||||
|
||||
class TaskTagAssignment(QueryModel, table=True):
|
||||
"""Association row mapping one task to one tag."""
|
||||
|
||||
__tablename__ = "task_tag_assignments" # pyright: ignore[reportAssignmentType]
|
||||
__table_args__ = (
|
||||
UniqueConstraint(
|
||||
"task_id",
|
||||
"tag_id",
|
||||
name="uq_task_tag_assignments_task_id_tag_id",
|
||||
),
|
||||
)
|
||||
|
||||
id: UUID = Field(default_factory=uuid4, primary_key=True)
|
||||
task_id: UUID = Field(foreign_key="tasks.id", index=True)
|
||||
tag_id: UUID = Field(foreign_key="task_tags.id", index=True)
|
||||
created_at: datetime = Field(default_factory=utcnow)
|
||||
36
backend/app/models/task_tags.py
Normal file
36
backend/app/models/task_tags.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""Task tag model for organization-scoped task categorization."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
from sqlalchemy import UniqueConstraint
|
||||
from sqlmodel import Field
|
||||
|
||||
from app.core.time import utcnow
|
||||
from app.models.tenancy import TenantScoped
|
||||
|
||||
RUNTIME_ANNOTATION_TYPES = (datetime,)
|
||||
|
||||
|
||||
class TaskTag(TenantScoped, table=True):
|
||||
"""Organization-scoped task tag used to classify and group tasks."""
|
||||
|
||||
__tablename__ = "task_tags" # pyright: ignore[reportAssignmentType]
|
||||
__table_args__ = (
|
||||
UniqueConstraint(
|
||||
"organization_id",
|
||||
"slug",
|
||||
name="uq_task_tags_organization_id_slug",
|
||||
),
|
||||
)
|
||||
|
||||
id: UUID = Field(default_factory=uuid4, primary_key=True)
|
||||
organization_id: UUID = Field(foreign_key="organizations.id", index=True)
|
||||
name: str
|
||||
slug: str = Field(index=True)
|
||||
color: str = Field(default="9e9e9e")
|
||||
description: str | None = None
|
||||
created_at: datetime = Field(default_factory=utcnow)
|
||||
updated_at: datetime = Field(default_factory=utcnow)
|
||||
Reference in New Issue
Block a user