docs(backend): Add Sprint 4 backend API verification and optional enhancement story

Backend APIs are 100% ready for Sprint 4 frontend implementation. Created comprehensive verification report and optional enhancement story for advanced UX fields.

Changes:
- Created backend_api_verification.md (detailed API analysis)
- Created Story 0: Backend API Enhancements (optional P2)
- Created 6 tasks for Story 0 implementation
- Updated Sprint 4 to include backend verification status
- Verified Story/Task CRUD APIs are complete
- Documented missing optional fields (AcceptanceCriteria, Tags, StoryPoints, Order)
- Provided workarounds for Sprint 4 MVP

Backend Status:
- Story API: 100% complete (8 endpoints)
- Task API: 100% complete (9 endpoints)
- Security: Multi-tenant isolation verified
- Missing optional fields: Can be deferred to future sprint

Frontend can proceed with P0/P1 Stories without blockers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Yaojia Wang
2025-11-05 21:45:09 +01:00
parent 8ce89c11e9
commit b3c92042ed
8 changed files with 1758 additions and 0 deletions

View File

@@ -0,0 +1,158 @@
---
task_id: task_5
story_id: story_0
sprint_id: sprint_4
status: not_started
type: backend
assignee: backend
created_date: 2025-11-05
completion_date: null
---
# Task 5: Update DTOs and API Endpoints
## What to do
Update StoryDto, TaskDto, and API request/response models to include the new fields. Update API endpoints to accept and return the new fields.
## Files to modify
- `colaflow-api/src/Modules/ProjectManagement/ColaFlow.Modules.ProjectManagement.Application/DTOs/StoryDto.cs`
- `colaflow-api/src/Modules/ProjectManagement/ColaFlow.Modules.ProjectManagement.Application/DTOs/TaskDto.cs`
- `colaflow-api/src/ColaFlow.API/Controllers/StoriesController.cs`
- `colaflow-api/src/ColaFlow.API/Controllers/TasksController.cs`
- `colaflow-api/src/Modules/ProjectManagement/ColaFlow.Modules.ProjectManagement.Application/Commands/CreateStory/CreateStoryCommand.cs`
- `colaflow-api/src/Modules/ProjectManagement/ColaFlow.Modules.ProjectManagement.Application/Commands/UpdateStory/UpdateStoryCommand.cs`
- `colaflow-api/src/Modules/ProjectManagement/ColaFlow.Modules.ProjectManagement.Application/Commands/CreateTask/CreateTaskCommand.cs`
- `colaflow-api/src/Modules/ProjectManagement/ColaFlow.Modules.ProjectManagement.Application/Commands/UpdateTask/UpdateTaskCommand.cs`
## Implementation
### StoryDto.cs
Add properties:
```csharp
public List<string> AcceptanceCriteria { get; init; } = new();
public List<string> Tags { get; init; } = new();
public int? StoryPoints { get; init; }
```
### TaskDto.cs
Add property:
```csharp
public int Order { get; init; }
```
### CreateStoryCommand.cs
Add properties:
```csharp
public List<string> AcceptanceCriteria { get; init; } = new();
public List<string> Tags { get; init; } = new();
public int? StoryPoints { get; init; }
```
Update handler to call new domain methods:
```csharp
if (command.AcceptanceCriteria.Any())
story.UpdateAcceptanceCriteria(command.AcceptanceCriteria);
if (command.Tags.Any())
story.UpdateTags(command.Tags);
if (command.StoryPoints.HasValue)
story.UpdateStoryPoints(command.StoryPoints);
```
### UpdateStoryCommand.cs
Add properties and handler logic (same as CreateStoryCommand).
### CreateTaskCommand.cs
Add property:
```csharp
public int? Order { get; init; }
```
Update handler to set Order:
```csharp
var task = WorkTask.Create(tenantId, command.Title, command.Description, storyId, priority, createdBy);
if (command.Order.HasValue)
task.UpdateOrder(command.Order.Value);
```
### UpdateTaskCommand.cs
Add property and handler logic (same as CreateTaskCommand).
### StoriesController.cs
Update request models:
```csharp
public record CreateStoryRequest
{
// Existing fields...
public List<string> AcceptanceCriteria { get; init; } = new();
public List<string> Tags { get; init; } = new();
public int? StoryPoints { get; init; }
}
public record UpdateStoryRequest
{
// Existing fields...
public List<string>? AcceptanceCriteria { get; init; }
public List<string>? Tags { get; init; }
public int? StoryPoints { get; init; }
}
```
### TasksController.cs
Add bulk reorder endpoint:
```csharp
[HttpPut("stories/{storyId:guid}/tasks/reorder")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<IActionResult> ReorderTasks(
Guid storyId,
[FromBody] ReorderTasksRequest request,
CancellationToken cancellationToken = default)
{
var command = new ReorderTasksCommand
{
StoryId = storyId,
TaskOrders = request.Tasks
};
await _mediator.Send(command, cancellationToken);
return NoContent();
}
public record ReorderTasksRequest
{
public List<TaskOrderDto> Tasks { get; init; } = new();
}
public record TaskOrderDto
{
public Guid TaskId { get; init; }
public int Order { get; init; }
}
```
Create ReorderTasksCommand and handler in Application layer.
## Acceptance
- [ ] StoryDto includes new fields
- [ ] TaskDto includes Order field
- [ ] CreateStoryCommand accepts new fields
- [ ] UpdateStoryCommand accepts new fields
- [ ] CreateTaskCommand accepts Order field
- [ ] UpdateTaskCommand accepts Order field
- [ ] Command handlers call domain methods
- [ ] ReorderTasks endpoint implemented
- [ ] API compiles successfully
- [ ] Swagger documentation updated