feat(backend): Create Sprint 2 backend Stories and Tasks

Created detailed implementation plans for Sprint 2 backend work:

Story 1: Audit Log Foundation (Phase 1)
- Task 1: Design AuditLog database schema and create migration
- Task 2: Create AuditLog entity and Repository
- Task 3: Implement EF Core SaveChangesInterceptor
- Task 4: Write unit tests for audit logging
- Task 5: Integrate with ProjectManagement Module

Story 2: Audit Log Core Features (Phase 2)
- Task 1: Implement Changed Fields Detection (JSON Diff)
- Task 2: Integrate User Context Tracking
- Task 3: Add Multi-Tenant Isolation
- Task 4: Implement Audit Query API
- Task 5: Write Integration Tests

Story 3: Sprint Management Module
- Task 1: Create Sprint Aggregate Root and Domain Events
- Task 2: Implement Sprint Repository and EF Core Configuration
- Task 3: Create CQRS Commands and Queries
- Task 4: Implement Burndown Chart Calculation
- Task 5: Add SignalR Real-Time Notifications
- Task 6: Write Integration Tests

Total: 3 Stories, 16 Tasks, 24 Story Points (8+8+8)
Estimated Duration: 10-12 days

All tasks include:
- Detailed technical implementation guidance
- Code examples and file paths
- Testing requirements (>= 90% coverage)
- Performance benchmarks (< 5ms audit overhead)
- Multi-tenant security validation

🤖 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-04 22:56:31 +01:00
parent d6cf86a4da
commit ebb56cc9f8
19 changed files with 4030 additions and 0 deletions

View File

@@ -0,0 +1,154 @@
---
task_id: sprint_2_story_1_task_5
story: sprint_2_story_1
status: not_started
estimated_hours: 3
created_date: 2025-11-05
assignee: Backend Team
---
# Task 5: Integrate with ProjectManagement Module
**Story**: Story 1 - Audit Log Foundation (Phase 1)
**Estimated**: 3 hours
## Description
Integrate the audit logging infrastructure with the existing ProjectManagement Module to ensure all Epic/Story/Task operations are automatically audited.
## Acceptance Criteria
- [ ] Audit logging works for Project CRUD operations
- [ ] Audit logging works for Epic CRUD operations
- [ ] Audit logging works for Story CRUD operations
- [ ] Audit logging works for Task CRUD operations
- [ ] Integration tests verify audit logs are created
- [ ] No performance degradation (< 5ms overhead)
## Implementation Details
**No Code Changes Required** - The EF Core Interceptor automatically captures all changes!
**Verification Steps**:
1. **Run Integration Tests**:
```bash
cd colaflow-api
dotnet test --filter "FullyQualifiedName~ProjectManagement.IntegrationTests"
```
2. **Verify Audit Logs Created**:
- Create a Project Check AuditLog table for "Create" entry
- Update an Epic Check AuditLog table for "Update" entry
- Delete a Story Check AuditLog table for "Delete" entry
3. **Performance Benchmark**:
```csharp
// Add to integration tests
[Fact]
public async Task CreateProject_ShouldHaveMinimalPerformanceOverhead()
{
// Measure time with audit logging enabled
var stopwatch = Stopwatch.StartNew();
await Mediator.Send(new CreateProjectCommand { /* ... */ });
stopwatch.Stop();
Assert.True(stopwatch.ElapsedMilliseconds < 100, "Project creation took too long");
}
```
**Files to Update**:
1. **Integration Test Verification**: `colaflow-api/tests/ColaFlow.Application.IntegrationTests/ProjectManagement/AuditLogIntegrationTests.cs`
```csharp
public class AuditLogIntegrationTests : IntegrationTestBase
{
[Fact]
public async Task CreateProject_ShouldCreateAuditLog()
{
// Arrange
var command = new CreateProjectCommand
{
Name = "Test Project",
Key = "TEST",
Description = "Test Description"
};
// Act
var projectId = await Mediator.Send(command);
// Assert
var auditLogs = await Context.AuditLogs
.Where(a => a.EntityType == "Project" && a.EntityId == projectId)
.ToListAsync();
Assert.Single(auditLogs);
Assert.Equal(AuditAction.Create, auditLogs[0].Action);
Assert.Equal(TenantId, auditLogs[0].TenantId);
}
[Fact]
public async Task UpdateEpic_ShouldCreateAuditLog_WithOldAndNewValues()
{
// Create Epic first
var epicId = await CreateTestEpic();
// Update Epic
await Mediator.Send(new UpdateEpicCommand
{
EpicId = epicId,
Title = "Updated Title"
});
// Assert audit log created
var auditLogs = await Context.AuditLogs
.Where(a => a.EntityType == "Epic" && a.EntityId == epicId && a.Action == AuditAction.Update)
.ToListAsync();
Assert.Single(auditLogs);
Assert.NotNull(auditLogs[0].OldValues);
Assert.NotNull(auditLogs[0].NewValues);
}
[Fact]
public async Task DeleteTask_ShouldCreateAuditLog()
{
// Test delete operation audit logging
// ...
}
}
```
## Technical Notes
- The SaveChangesInterceptor automatically captures all EF Core operations
- No changes to Command Handlers required
- Verify multi-tenant isolation works correctly
- Check audit logs in database after each operation
## Testing
**Integration Tests to Create**:
1. Project Create/Update/Delete audit logging
2. Epic Create/Update/Delete audit logging
3. Story Create/Update/Delete audit logging
4. Task Create/Update/Delete audit logging
5. Multi-tenant isolation verification
6. Performance overhead verification (< 5ms)
**Run Tests**:
```bash
dotnet test --filter "FullyQualifiedName~AuditLogIntegration"
```
## Definition of Done
- All 4 entity types (Project/Epic/Story/Task) are audited
- Integration tests verify audit logs are created
- Multi-tenant isolation verified
- Performance benchmark met (< 5ms overhead)
- Git commit created
---
**Created**: 2025-11-05 by Backend Agent