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,69 @@
---
task_id: sprint_2_story_1_task_1
story: sprint_2_story_1
status: not_started
estimated_hours: 4
created_date: 2025-11-05
assignee: Backend Team
---
# Task 1: Design AuditLog Database Schema and Create Migration
**Story**: Story 1 - Audit Log Foundation (Phase 1)
**Estimated**: 4 hours
## Description
Design and implement the AuditLog database table schema with proper columns, data types, and indexes to support efficient audit querying and multi-tenant isolation.
## Acceptance Criteria
- [ ] Database migration created with AuditLog table
- [ ] All required columns defined with correct data types
- [ ] Composite indexes created for query optimization
- [ ] Multi-tenant isolation enforced (TenantId column)
- [ ] Migration applied successfully
## Implementation Details
**Table Schema**:
```sql
CREATE TABLE AuditLogs (
Id UUID PRIMARY KEY,
TenantId UUID NOT NULL,
EntityType VARCHAR(100) NOT NULL,
EntityId UUID NOT NULL,
Action VARCHAR(20) NOT NULL, -- 'Create', 'Update', 'Delete'
UserId UUID NULL,
Timestamp TIMESTAMPTZ NOT NULL DEFAULT NOW(),
OldValues JSONB NULL,
NewValues JSONB NULL,
CONSTRAINT FK_AuditLogs_Tenants FOREIGN KEY (TenantId) REFERENCES Tenants(Id) ON DELETE CASCADE
);
-- Indexes for query performance
CREATE INDEX IX_AuditLogs_TenantId_EntityType_EntityId ON AuditLogs(TenantId, EntityType, EntityId);
CREATE INDEX IX_AuditLogs_Timestamp ON AuditLogs(Timestamp DESC);
CREATE INDEX IX_AuditLogs_UserId ON AuditLogs(UserId);
```
**Files to Modify**:
- Create: `colaflow-api/src/ColaFlow.Infrastructure/Data/Migrations/{timestamp}_AddAuditLogTable.cs`
## Technical Notes
- Use PostgreSQL JSONB for `OldValues`/`NewValues` (flexible schema, indexed queries)
- Composite index on `(TenantId, EntityType, EntityId)` for efficient entity history queries
- `Timestamp` index with DESC order for recent logs queries
- Consider table partitioning for future scalability (Phase 4)
## Testing
- Verify migration runs without errors
- Check indexes are created
- Verify foreign key constraints work
---
**Created**: 2025-11-05 by Backend Agent