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 <noreply@anthropic.com>
This commit is contained in:
2026-07-17 08:44:36 +08:00
parent cd2efe3587
commit e8b26487db
3 changed files with 25 additions and 338 deletions
+11 -2
View File
@@ -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