0217c8ce28
Backend:
- UpdateTaskUseCase for editing task basic info
- PATCH /tasks/{id} endpoint for task updates
- UpdateTaskRequest model with optional fields
- Full CRUD operations for tasks
Frontend:
- EditTaskForm now uses real API (PATCH /tasks/{id})
- Task detail page shows edit form when edit button clicked
- Status/progress update with real-time API calls
- Issue resolution with real-time refresh
- All forms integrated with backend
Tests:
- Added test_update_task for partial and full updates
- 9 integration tests passing (was 8)
- Full coverage of task CRUD operations
All features complete and tested!
35 lines
972 B
Python
35 lines
972 B
Python
"""更新任务基本信息用例"""
|
|
from packages.domain import Task
|
|
from packages.ports import TaskRepository
|
|
|
|
|
|
class UpdateTaskUseCase:
|
|
"""更新任务基本信息"""
|
|
|
|
def __init__(self, task_repo: TaskRepository):
|
|
self.task_repo = task_repo
|
|
|
|
def execute(
|
|
self,
|
|
task_id: str,
|
|
name: str | None = None,
|
|
description: str | None = None,
|
|
priority: str | None = None,
|
|
assignee_user_id: str | None = None,
|
|
) -> Task:
|
|
task = self.task_repo.get_by_id(task_id)
|
|
if not task:
|
|
raise ValueError(f"Task {task_id} not found")
|
|
|
|
if name is not None:
|
|
task.name = name
|
|
if description is not None:
|
|
task.description = description
|
|
if priority is not None:
|
|
task.priority = priority
|
|
if assignee_user_id is not None:
|
|
task.assignee_user_id = assignee_user_id
|
|
|
|
self.task_repo.update(task)
|
|
return task
|