feat: add EstimatedMinutes field and general PUT update endpoint for tasks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-26 22:10:48 -05:00
parent e12f78c479
commit 58d57509e5
7 changed files with 321 additions and 0 deletions

View File

@@ -51,6 +51,7 @@ public class TasksController(ITaskRepository taskRepo, ILogger<TasksController>
Description = request.Description,
Category = request.Category,
ParentTaskId = request.ParentTaskId,
EstimatedMinutes = request.EstimatedMinutes,
Status = WorkTaskStatus.Pending
};
@@ -161,6 +162,22 @@ public class TasksController(ITaskRepository taskRepo, ILogger<TasksController>
return Ok(ApiResponse<WorkTask>.Ok(task));
}
[HttpPut("{id:int}")]
public async Task<IActionResult> Update(int id, [FromBody] UpdateTaskRequest request)
{
var task = await taskRepo.GetByIdAsync(id);
if (task is null)
return NotFound(ApiResponse.Fail("Task not found"));
if (request.Title is not null) task.Title = request.Title;
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;
await taskRepo.UpdateAsync(task);
return Ok(ApiResponse<WorkTask>.Ok(task));
}
[HttpDelete("{id:int}")]
public async Task<IActionResult> Delete(int id)
{