Files
ColaFlow/docs/plans/sprint_4_story_0_task_5.md
Yaojia Wang b3c92042ed 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>
2025-11-05 21:45:09 +01:00

4.2 KiB

task_id, story_id, sprint_id, status, type, assignee, created_date, completion_date
task_id story_id sprint_id status type assignee created_date completion_date
task_5 story_0 sprint_4 not_started backend backend 2025-11-05 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:

public List<string> AcceptanceCriteria { get; init; } = new();
public List<string> Tags { get; init; } = new();
public int? StoryPoints { get; init; }

TaskDto.cs

Add property:

public int Order { get; init; }

CreateStoryCommand.cs

Add properties:

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:

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:

public int? Order { get; init; }

Update handler to set Order:

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:

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:

[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