From e8b26487db2269e3dae30255015f18e2f89f6725 Mon Sep 17 00:00:00 2001 From: indigo Date: Fri, 17 Jul 2026 08:44:36 +0800 Subject: [PATCH] Add task_details to the single-asset endpoint response GET /assets/{id} never returned task_details (the schema didn't even declare the field), unlike GET /shots/{id} which already populated it correctly. This silently broke the asset detail panel's task list - surfaced while wiring real task data into it on the frontend. Co-Authored-By: Claude Sonnet 5 --- backend/routers/assets.py | 13 +- backend/schemas/asset.py | 27 +- .../project/ProjectMembersManager.vue | 323 ------------------ 3 files changed, 25 insertions(+), 338 deletions(-) delete mode 100644 frontend/src/components/project/ProjectMembersManager.vue diff --git a/backend/routers/assets.py b/backend/routers/assets.py index 5475fd0..f2f5ecf 100644 --- a/backend/routers/assets.py +++ b/backend/routers/assets.py @@ -474,10 +474,19 @@ async def get_asset( # This avoids a separate COUNT query active_tasks = [task for task in asset.tasks if task.deleted_at is None] task_count = len(active_tasks) - + asset_data = AssetResponse.model_validate(asset) asset_data.task_count = task_count - + asset_data.task_details = [ + TaskStatusInfo( + task_type=task.task_type, + status=task.status, + task_id=task.id, + assigned_user_id=task.assigned_user_id + ) + for task in active_tasks + ] + return asset_data diff --git a/backend/schemas/asset.py b/backend/schemas/asset.py index 5f4f466..cbb0157 100644 --- a/backend/schemas/asset.py +++ b/backend/schemas/asset.py @@ -25,19 +25,6 @@ class AssetUpdate(BaseModel): status: Optional[AssetStatus] = None -class AssetResponse(AssetBase): - id: int - project_id: int - created_at: datetime - updated_at: datetime - - # Summary information - task_count: int = 0 - - class Config: - from_attributes = True - - class TaskStatusInfo(BaseModel): task_type: str # Changed from TaskType enum to str to support custom task types status: str # Changed from TaskStatus enum to str to support custom statuses @@ -45,6 +32,20 @@ class TaskStatusInfo(BaseModel): assigned_user_id: Optional[int] = None +class AssetResponse(AssetBase): + id: int + project_id: int + created_at: datetime + updated_at: datetime + + # Summary information + task_count: int = 0 + task_details: List[TaskStatusInfo] = Field(default_factory=list, description="Detailed task information") + + class Config: + from_attributes = True + + class AssetListResponse(BaseModel): id: int name: str diff --git a/frontend/src/components/project/ProjectMembersManager.vue b/frontend/src/components/project/ProjectMembersManager.vue deleted file mode 100644 index 5d465bb..0000000 --- a/frontend/src/components/project/ProjectMembersManager.vue +++ /dev/null @@ -1,323 +0,0 @@ - - - \ No newline at end of file