chore: update generated files to orval v8.3.0 and adjust related interfaces

This commit is contained in:
Abhimanyu Saharan
2026-02-12 18:04:35 +05:30
parent c73103d5c9
commit 2ebdead95b
232 changed files with 9434 additions and 6021 deletions

View File

@@ -31,6 +31,7 @@ from app.schemas.souls_directory import (
SoulsDirectorySearchResponse,
SoulsDirectorySoulRef,
)
from app.schemas.task_tags import TaskTagCreate, TaskTagRead, TaskTagRef, TaskTagUpdate
from app.schemas.tasks import TaskCreate, TaskRead, TaskUpdate
from app.schemas.users import UserCreate, UserRead, UserUpdate
@@ -70,6 +71,10 @@ __all__ = [
"SoulsDirectoryMarkdownResponse",
"SoulsDirectorySearchResponse",
"SoulsDirectorySoulRef",
"TaskTagCreate",
"TaskTagRead",
"TaskTagRef",
"TaskTagUpdate",
"TaskCreate",
"TaskRead",
"TaskUpdate",

View File

@@ -0,0 +1,126 @@
"""Schemas for task-tag CRUD payloads."""
from __future__ import annotations
import re
from datetime import datetime
from typing import Self
from uuid import UUID
from pydantic import field_validator, model_validator
from sqlmodel import SQLModel
from app.schemas.common import NonEmptyStr
HEX_COLOR_RE = re.compile(r"^[0-9a-f]{6}$")
RUNTIME_ANNOTATION_TYPES = (datetime, UUID, NonEmptyStr)
def _normalize_color(value: str | None) -> str | None:
if value is None:
return None
cleaned = value.strip().lower().lstrip("#")
if not cleaned:
return None
if not HEX_COLOR_RE.fullmatch(cleaned):
raise ValueError("color must be a 6-digit hex value")
return cleaned
class TaskTagBase(SQLModel):
"""Shared task-tag fields for create/read payloads."""
name: str
slug: str
color: str = "9e9e9e"
description: str | None = None
class TaskTagRef(SQLModel):
"""Compact task-tag representation embedded in task payloads."""
id: UUID
name: str
slug: str
color: str
class TaskTagCreate(SQLModel):
"""Payload for creating a task tag."""
name: NonEmptyStr
slug: str | None = None
color: str = "9e9e9e"
description: str | None = None
@field_validator("slug", mode="before")
@classmethod
def normalize_slug(cls, value: object) -> object | None:
"""Treat empty slug strings as unset so API can auto-generate."""
if value is None:
return None
if isinstance(value, str):
cleaned = value.strip()
return cleaned or None
return value
@field_validator("color", mode="before")
@classmethod
def normalize_color(cls, value: object) -> object:
"""Normalize color to lowercase hex without a leading hash."""
if isinstance(value, str):
normalized = _normalize_color(value)
if normalized is None:
raise ValueError("color is required")
return normalized
return value
class TaskTagUpdate(SQLModel):
"""Payload for partial task-tag updates."""
name: NonEmptyStr | None = None
slug: str | None = None
color: str | None = None
description: str | None = None
@field_validator("slug", mode="before")
@classmethod
def normalize_slug(cls, value: object) -> object | None:
"""Treat empty slug strings as unset so API can auto-generate."""
if value is None:
return None
if isinstance(value, str):
cleaned = value.strip()
return cleaned or None
return value
@field_validator("color", mode="before")
@classmethod
def normalize_color(cls, value: object) -> object | None:
"""Normalize color to lowercase hex without a leading hash."""
if value is None:
return None
if isinstance(value, str):
normalized = _normalize_color(value)
if normalized is None:
raise ValueError("color must be a 6-digit hex value")
return normalized
return value
@model_validator(mode="after")
def require_some_update(self) -> Self:
"""Reject empty update payloads to avoid no-op patch calls."""
if not self.model_fields_set:
raise ValueError("At least one field is required")
return self
class TaskTagRead(TaskTagBase):
"""Task-tag payload returned from API endpoints."""
id: UUID
organization_id: UUID
task_count: int = 0
created_at: datetime
updated_at: datetime

View File

@@ -10,12 +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
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)
RUNTIME_ANNOTATION_TYPES = (datetime, UUID, NonEmptyStr, TaskTagRef)
class TaskBase(SQLModel):
@@ -28,6 +29,7 @@ class TaskBase(SQLModel):
due_at: datetime | None = None
assigned_agent_id: UUID | None = None
depends_on_task_ids: list[UUID] = Field(default_factory=list)
tag_ids: list[UUID] = Field(default_factory=list)
class TaskCreate(TaskBase):
@@ -46,6 +48,7 @@ class TaskUpdate(SQLModel):
due_at: datetime | None = None
assigned_agent_id: UUID | None = None
depends_on_task_ids: list[UUID] | None = None
tag_ids: list[UUID] | None = None
comment: NonEmptyStr | None = None
@field_validator("comment", mode="before")
@@ -77,6 +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)
class TaskCommentCreate(SQLModel):

View File

@@ -12,6 +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.tasks import TaskRead
RUNTIME_ANNOTATION_TYPES = (
@@ -22,6 +23,7 @@ RUNTIME_ANNOTATION_TYPES = (
BoardGroupRead,
BoardMemoryRead,
BoardRead,
TaskTagRef,
)
@@ -57,6 +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)
created_at: datetime
updated_at: datetime