---
task_id: task_2
story_id: story_0
sprint_id: sprint_4
status: not_started
type: backend
assignee: backend
created_date: 2025-11-05
completion_date: null
---

# Task 2: Add StoryPoints Field to Story Entity

## What to do

Add a StoryPoints field to the Story entity for estimating Story complexity using Fibonacci numbers (1, 2, 3, 5, 8, 13, 21, etc.).

## Files to modify

- `colaflow-api/src/Modules/ProjectManagement/ColaFlow.Modules.ProjectManagement.Domain/Aggregates/ProjectAggregate/Story.cs`
- `colaflow-api/src/Modules/ProjectManagement/ColaFlow.Modules.ProjectManagement.Infrastructure/Persistence/Configurations/StoryConfiguration.cs`

## Implementation

### Story.cs Changes

Add property:
```csharp
public int? StoryPoints { get; private set; }
```

Add method:
```csharp
public void UpdateStoryPoints(int? points)
{
    if (points.HasValue)
    {
        if (points.Value < 0)
            throw new DomainException("Story points cannot be negative");

        if (points.Value > 100)
            throw new DomainException("Story points cannot exceed 100");
    }

    StoryPoints = points;
    UpdatedAt = DateTime.UtcNow;
}
```

### StoryConfiguration.cs Changes

Add column configuration:
```csharp
builder.Property(s => s.StoryPoints)
    .IsRequired(false);
```

## Acceptance

- [ ] Story entity has StoryPoints property (nullable int)
- [ ] UpdateStoryPoints method validates range (0-100)
- [ ] EF Core configuration includes StoryPoints column
- [ ] Code compiles successfully
- [ ] Validation tests written
- [ ] Tests passing
