feat(api): add parentTaskId support to task update and MCP create
Allow setting ParentTaskId when updating a task via the API (with validation that the parent exists) and when creating a task via the MCP create_task tool. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -173,6 +173,13 @@ public class TasksController(ITaskRepository taskRepo, ILogger<TasksController>
|
||||
if (request.Description is not null) task.Description = request.Description;
|
||||
if (request.Category is not null) task.Category = request.Category;
|
||||
if (request.EstimatedMinutes.HasValue) task.EstimatedMinutes = request.EstimatedMinutes;
|
||||
if (request.ParentTaskId.HasValue)
|
||||
{
|
||||
var parent = await taskRepo.GetByIdAsync(request.ParentTaskId.Value);
|
||||
if (parent is null)
|
||||
return BadRequest(ApiResponse.Fail("Parent task not found"));
|
||||
task.ParentTaskId = request.ParentTaskId;
|
||||
}
|
||||
|
||||
await taskRepo.UpdateAsync(task);
|
||||
return Ok(ApiResponse<WorkTask>.Ok(task));
|
||||
|
||||
Reference in New Issue
Block a user