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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user