feat(tags): add tag management interfaces and update related schemas
This commit is contained in:
@@ -31,7 +31,7 @@ from app.schemas.souls_directory import (
|
||||
SoulsDirectorySearchResponse,
|
||||
SoulsDirectorySoulRef,
|
||||
)
|
||||
from app.schemas.task_tags import TaskTagCreate, TaskTagRead, TaskTagRef, TaskTagUpdate
|
||||
from app.schemas.tags import TagCreate, TagRead, TagRef, TagUpdate
|
||||
from app.schemas.tasks import TaskCreate, TaskRead, TaskUpdate
|
||||
from app.schemas.users import UserCreate, UserRead, UserUpdate
|
||||
|
||||
@@ -71,10 +71,10 @@ __all__ = [
|
||||
"SoulsDirectoryMarkdownResponse",
|
||||
"SoulsDirectorySearchResponse",
|
||||
"SoulsDirectorySoulRef",
|
||||
"TaskTagCreate",
|
||||
"TaskTagRead",
|
||||
"TaskTagRef",
|
||||
"TaskTagUpdate",
|
||||
"TagCreate",
|
||||
"TagRead",
|
||||
"TagRef",
|
||||
"TagUpdate",
|
||||
"TaskCreate",
|
||||
"TaskRead",
|
||||
"TaskUpdate",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Schemas for task-tag CRUD payloads."""
|
||||
"""Schemas for tag CRUD payloads."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -27,8 +27,8 @@ def _normalize_color(value: str | None) -> str | None:
|
||||
return cleaned
|
||||
|
||||
|
||||
class TaskTagBase(SQLModel):
|
||||
"""Shared task-tag fields for create/read payloads."""
|
||||
class TagBase(SQLModel):
|
||||
"""Shared tag fields for create/read payloads."""
|
||||
|
||||
name: str
|
||||
slug: str
|
||||
@@ -36,8 +36,8 @@ class TaskTagBase(SQLModel):
|
||||
description: str | None = None
|
||||
|
||||
|
||||
class TaskTagRef(SQLModel):
|
||||
"""Compact task-tag representation embedded in task payloads."""
|
||||
class TagRef(SQLModel):
|
||||
"""Compact tag representation embedded in task payloads."""
|
||||
|
||||
id: UUID
|
||||
name: str
|
||||
@@ -45,8 +45,8 @@ class TaskTagRef(SQLModel):
|
||||
color: str
|
||||
|
||||
|
||||
class TaskTagCreate(SQLModel):
|
||||
"""Payload for creating a task tag."""
|
||||
class TagCreate(SQLModel):
|
||||
"""Payload for creating a tag."""
|
||||
|
||||
name: NonEmptyStr
|
||||
slug: str | None = None
|
||||
@@ -76,8 +76,8 @@ class TaskTagCreate(SQLModel):
|
||||
return value
|
||||
|
||||
|
||||
class TaskTagUpdate(SQLModel):
|
||||
"""Payload for partial task-tag updates."""
|
||||
class TagUpdate(SQLModel):
|
||||
"""Payload for partial tag updates."""
|
||||
|
||||
name: NonEmptyStr | None = None
|
||||
slug: str | None = None
|
||||
@@ -116,8 +116,8 @@ class TaskTagUpdate(SQLModel):
|
||||
return self
|
||||
|
||||
|
||||
class TaskTagRead(TaskTagBase):
|
||||
"""Task-tag payload returned from API endpoints."""
|
||||
class TagRead(TagBase):
|
||||
"""Tag payload returned from API endpoints."""
|
||||
|
||||
id: UUID
|
||||
organization_id: UUID
|
||||
@@ -10,13 +10,13 @@ from pydantic import field_validator, model_validator
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
from app.schemas.common import NonEmptyStr
|
||||
from app.schemas.task_tags import TaskTagRef
|
||||
from app.schemas.tags import TagRef
|
||||
|
||||
TaskStatus = Literal["inbox", "in_progress", "review", "done"]
|
||||
STATUS_REQUIRED_ERROR = "status is required"
|
||||
# Keep these symbols as runtime globals so Pydantic can resolve
|
||||
# deferred annotations reliably.
|
||||
RUNTIME_ANNOTATION_TYPES = (datetime, UUID, NonEmptyStr, TaskTagRef)
|
||||
RUNTIME_ANNOTATION_TYPES = (datetime, UUID, NonEmptyStr, TagRef)
|
||||
|
||||
|
||||
class TaskBase(SQLModel):
|
||||
@@ -80,7 +80,7 @@ class TaskRead(TaskBase):
|
||||
updated_at: datetime
|
||||
blocked_by_task_ids: list[UUID] = Field(default_factory=list)
|
||||
is_blocked: bool = False
|
||||
tags: list[TaskTagRef] = Field(default_factory=list)
|
||||
tags: list[TagRef] = Field(default_factory=list)
|
||||
|
||||
|
||||
class TaskCommentCreate(SQLModel):
|
||||
|
||||
@@ -12,7 +12,7 @@ from app.schemas.approvals import ApprovalRead
|
||||
from app.schemas.board_groups import BoardGroupRead
|
||||
from app.schemas.board_memory import BoardMemoryRead
|
||||
from app.schemas.boards import BoardRead
|
||||
from app.schemas.task_tags import TaskTagRef
|
||||
from app.schemas.tags import TagRef
|
||||
from app.schemas.tasks import TaskRead
|
||||
|
||||
RUNTIME_ANNOTATION_TYPES = (
|
||||
@@ -23,7 +23,7 @@ RUNTIME_ANNOTATION_TYPES = (
|
||||
BoardGroupRead,
|
||||
BoardMemoryRead,
|
||||
BoardRead,
|
||||
TaskTagRef,
|
||||
TagRef,
|
||||
)
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class BoardGroupTaskSummary(SQLModel):
|
||||
assignee: str | None = None
|
||||
due_at: datetime | None = None
|
||||
in_progress_at: datetime | None = None
|
||||
tags: list[TaskTagRef] = Field(default_factory=list)
|
||||
tags: list[TagRef] = Field(default_factory=list)
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
Reference in New Issue
Block a user