Optimize shot table loading performance

- Pass episode_id filter to backend API instead of client-side filtering,
  reducing payload size when an episode is selected
- Skip getShot refetch in ShotDetailPanel when initialShot prop is provided
- Fix redundant DB query in list_shots: read project.custom_task_statuses
  directly from the already-fetched project object
- Add missing indexes on Task.shot_id, Task.assigned_user_id,
  Task.deleted_at and Episode.project_id; add add_perf_indexes.py
  migration script to apply them to existing databases
- Center login page layout
- Update CLAUDE.md and AGENTS.md with correct venv path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 00:30:18 +08:00
parent 0dd37d1706
commit 0acf9ddff2
13 changed files with 151 additions and 81 deletions
+13 -8
View File
@@ -28,6 +28,14 @@ class ShotUpdate(BaseModel):
project_id: Optional[int] = Field(None, description="Project ID - must match episode's project")
class TaskStatusInfo(BaseModel):
"""Task status information for table display"""
task_type: str # String to support custom task types
status: str # Changed from TaskStatus enum to str to support custom statuses
task_id: Optional[int] = None
assigned_user_id: Optional[int] = None
class ShotResponse(ShotBase):
id: int
project_id: int # Make required in response
@@ -40,19 +48,16 @@ class ShotResponse(ShotBase):
# Optional computed field for display
project_name: Optional[str] = Field(None, description="Project name for display purposes")
# Task status information for detail display
task_status: Dict[str, Optional[str]] = Field(default_factory=dict, description="Task status by task type")
task_ids: Dict[str, int] = Field(default_factory=dict, description="Task IDs by task type")
task_details: List[TaskStatusInfo] = Field(default_factory=list, description="Detailed task information")
class Config:
from_attributes = True
class TaskStatusInfo(BaseModel):
"""Task status information for table display"""
task_type: str # String to support custom task types
status: str # Changed from TaskStatus enum to str to support custom statuses
task_id: Optional[int] = None
assigned_user_id: Optional[int] = None
class ShotListResponse(BaseModel):
id: int
name: str