Commit Graph

22 Commits

Author SHA1 Message Date
Yaojia Wang
58e08f9fa7 feat(backend): Implement Sprint CQRS Commands and Queries (Task 3)
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
Implemented comprehensive CQRS pattern for Sprint module:

Commands:
- UpdateSprintCommand: Update sprint details with validation
- DeleteSprintCommand: Delete sprints (business rule: cannot delete active sprints)
- StartSprintCommand: Transition sprint from Planned to Active
- CompleteSprintCommand: Transition sprint from Active to Completed
- AddTaskToSprintCommand: Add tasks to sprint with validation
- RemoveTaskFromSprintCommand: Remove tasks from sprint

Queries:
- GetSprintByIdQuery: Get sprint by ID with DTO mapping
- GetSprintsByProjectIdQuery: Get all sprints for a project
- GetActiveSprintsQuery: Get all active sprints across projects

Infrastructure:
- Created IApplicationDbContext interface for Application layer DB access
- Registered IApplicationDbContext in DI container
- Added Microsoft.EntityFrameworkCore package to Application layer
- Updated UnitOfWork to expose GetDbContext() method

API:
- Created SprintsController with all CRUD and lifecycle endpoints
- Implemented proper HTTP methods (POST, PUT, DELETE, GET)
- Added sprint status transition endpoints (start, complete)
- Added task management endpoints (add/remove tasks)

All tests passing. Ready for Tasks 4-6.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 00:25:23 +01:00
Yaojia Wang
6cbf7dc6dc feat(backend): Implement Audit Query API (CQRS) - Sprint 2 Story 2 Task 4
Implemented complete REST API for querying audit logs using CQRS pattern.

Features:
- GET /api/v1/auditlogs/{id} - Retrieve specific audit log
- GET /api/v1/auditlogs/entity/{entityType}/{entityId} - Get entity history
- GET /api/v1/auditlogs/recent?count=100 - Get recent logs (max 1000)

Implementation:
- AuditLogDto - Transfer object for query results
- GetAuditLogByIdQuery + Handler
- GetAuditLogsByEntity Query + Handler
- GetRecentAuditLogsQuery + Handler
- AuditLogsController with 3 endpoints

Technical:
- Multi-tenant isolation via Global Query Filters (automatic)
- Read-only query endpoints (no mutations)
- Swagger/OpenAPI documentation
- Proper HTTP status codes (200 OK, 404 Not Found)
- Cancellation token support
- Primary constructor pattern (modern C# style)

Tests: Build succeeded, no new test failures introduced

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 23:56:37 +01:00
Yaojia Wang
08b317e789 Add trace files.
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
2025-11-04 23:28:56 +01:00
Yaojia Wang
d6cf86a4da docs(agents): Add auto-generation capability to backend agent for Stories/Tasks
Enhanced backend agent with ability to automatically create Stories and Tasks from Sprint files.

Changes:
- Added Overview section explaining auto-generation workflow
- Updated "When to Create Stories/Tasks" with Sprint-based workflow
- Added new workflow section "Auto-Generate Stories/Tasks from Sprint" with detailed steps and example
- Added 3 new rules for auto-generation, objective analysis, and story point estimation
- Updated Core Responsibilities to include Story & Task Management

This enables backend agent to:
1. Read Sprint files created by Product Manager
2. Analyze Sprint objectives to identify backend work
3. Auto-create Stories for each backend feature
4. Auto-create Tasks for each Story
5. Update Sprint file with Story links

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 22:39:28 +01:00
Yaojia Wang
61e3ca8293 docs(agents): Add auto-generate Stories/Tasks capability to frontend agent
Enhanced frontend agent with ability to automatically create Stories and Tasks from Sprint files.

Changes:
- Added Overview section explaining auto-generation workflow
- Updated "When to Create Stories/Tasks" with Sprint-driven approach
- Added "Workflow: Auto-Generate Stories/Tasks from Sprint" section with detailed steps and example
- Added 3 new Key Rules: auto-generate from Sprint, analyze objectives, estimate story points

Frontend agent can now:
1. Read Sprint file to understand objectives
2. Identify frontend-specific work items
3. Auto-create Stories for each UI feature
4. Auto-create Tasks for each Story
5. Update Sprint file with Story links

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 22:39:02 +01:00
Yaojia Wang
f78dda8dc8 docs(agents): Add Story & Task management responsibilities to frontend agent
Update frontend agent configuration to include Story/Task creation and management capabilities.

Changes:
- Added Story & Task Management to Core Responsibilities
- Added comprehensive Story/Task Management section with:
  - When to create Stories/Tasks
  - File structure and naming conventions
  - Simplified Story and Task templates
  - Complete workflow for creating and managing Stories/Tasks
  - Key rules for Story/Task management

Frontend agents can now create and manage their own Stories and Tasks in docs/plans/.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 22:35:42 +01:00
Yaojia Wang
01e1263c12 Updare progress
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
2025-11-04 12:28:53 +01:00
Yaojia Wang
1246445a0b fix: Add JSON string enum converter for Issue Management API
- Configure AddControllers() with JsonStringEnumConverter
- Allows API to accept Issue type/priority/status as strings ("Story", "High", "Backlog")
- Frontend can now send readable enum values instead of integers
- All Issue Management CRUD operations tested and working

Test results:
- Create Issue (Story, Bug, Task) ✓
- List all issues ✓
- Filter by status (Backlog, InProgress) ✓
- Change issue status (Kanban workflow) ✓
- Update issue details ✓
- Multi-tenant isolation verified ✓
2025-11-04 12:04:57 +01:00
Yaojia Wang
6b11af9bea feat(backend): Implement complete Issue Management Module
Implemented full-featured Issue Management module following Clean Architecture,
DDD, CQRS and Event Sourcing patterns to support Kanban board functionality.

## Domain Layer
- Issue aggregate root with business logic
- IssueType, IssueStatus, IssuePriority enums
- Domain events: IssueCreated, IssueUpdated, IssueStatusChanged, IssueAssigned, IssueDeleted
- IIssueRepository and IUnitOfWork interfaces
- Domain exceptions (DomainException, NotFoundException)

## Application Layer
- **Commands**: CreateIssue, UpdateIssue, ChangeIssueStatus, AssignIssue, DeleteIssue
- **Queries**: GetIssueById, ListIssues, ListIssuesByStatus
- Command/Query handlers with validation
- FluentValidation validators for all commands
- Event handlers for domain events
- IssueDto for data transfer
- ValidationBehavior pipeline

## Infrastructure Layer
- IssueManagementDbContext with EF Core 9.0
- IssueConfiguration for entity mapping
- IssueRepository implementation
- UnitOfWork implementation
- Multi-tenant support with TenantId filtering
- Optimized indexes for query performance

## API Layer
- IssuesController with full REST API
  - GET /api/v1/projects/{projectId}/issues (list with optional status filter)
  - GET /api/v1/projects/{projectId}/issues/{id} (get by id)
  - POST /api/v1/projects/{projectId}/issues (create)
  - PUT /api/v1/projects/{projectId}/issues/{id} (update)
  - PUT /api/v1/projects/{projectId}/issues/{id}/status (change status for Kanban)
  - PUT /api/v1/projects/{projectId}/issues/{id}/assign (assign to user)
  - DELETE /api/v1/projects/{projectId}/issues/{id} (delete)
- Request models: CreateIssueRequest, UpdateIssueRequest, ChangeStatusRequest, AssignIssueRequest
- JWT authentication required
- Real-time SignalR notifications integrated

## Module Registration
- Added AddIssueManagementModule extension method
- Registered in Program.cs
- Added IMDatabase connection string
- Added project references to ColaFlow.API.csproj

## Architecture Patterns
-  Clean Architecture (Domain, Application, Infrastructure, API layers)
-  DDD (Aggregate roots, value objects, domain events)
-  CQRS (Command/Query separation)
-  Event Sourcing (Domain events with MediatR)
-  Repository Pattern (IIssueRepository)
-  Unit of Work (Transactional consistency)
-  Dependency Injection
-  FluentValidation
-  Multi-tenancy support

## Real-time Features
- SignalR integration via IRealtimeNotificationService
- NotifyIssueCreated, NotifyIssueUpdated, NotifyIssueStatusChanged, NotifyIssueAssigned, NotifyIssueDeleted
- Project-level broadcasting for collaborative editing

## Next Steps
1. Stop running API process if exists
2. Run: dotnet ef migrations add InitialIssueModule --context IssueManagementDbContext --startup-project ../../../ColaFlow.API
3. Run: dotnet ef database update --context IssueManagementDbContext --startup-project ../../../ColaFlow.API
4. Create test scripts
5. Verify all CRUD operations and real-time notifications

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 11:38:04 +01:00
Yaojia Wang
6d2396f3c1 In progress
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
2025-11-04 10:31:50 +01:00
Yaojia Wang
ef409b8ba5 Enhance BE agent 2025-11-04 10:31:04 +01:00
Yaojia Wang
f21d9cd6d4 feat(agents): Enforce mandatory testing in backend agent
Update backend agent to enforce testing requirements:
- Extended workflow from 8 to 9 steps with explicit test phases
- Added CRITICAL Testing Rule: Must run dotnet test after every change
- Never commit with failing tests or compilation errors
- Updated Best Practices to emphasize testing (item 8)
- Removed outdated TypeScript/NestJS examples
- Updated Tech Stack to reflect actual .NET 9 stack
- Simplified configuration for better clarity

Changes:
- Workflow step 6: "Run Tests: MUST run dotnet test - fix any failures"
- Workflow step 7: "Git Commit: Auto-commit ONLY when all tests pass"
- Added "CRITICAL Testing Rule" section after workflow
- Removed Project Structure, Naming Conventions, Code Standards sections
- Updated tech stack: C# + .NET 9 + ASP.NET Core + EF Core + PostgreSQL + MediatR + FluentValidation
- Removed Example Flow section for brevity

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 10:28:10 +01:00
Yaojia Wang
172d0de1fe Add test
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
2025-11-04 00:20:42 +01:00
Yaojia Wang
b3bea05488 Summary
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
2025-11-03 23:37:50 +01:00
Yaojia Wang
312df4b70e Adjust test
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
2025-11-03 22:29:31 +01:00
Yaojia Wang
a220e5d5d7 Refactor
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
2025-11-03 21:02:14 +01:00
Yaojia Wang
4183b10b39 Commit all scripts
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
2025-11-03 17:19:20 +01:00
Yaojia Wang
9e2edb2965 feat(backend): Implement Refresh Token mechanism (Day 5 Phase 1)
Implemented secure refresh token rotation with the following features:
- RefreshToken domain entity with IsExpired(), IsRevoked(), IsActive(), Revoke() methods
- IRefreshTokenService with token generation, rotation, and revocation
- RefreshTokenService with SHA-256 hashing and token family tracking
- RefreshTokenRepository for database operations
- Database migration for refresh_tokens table with proper indexes
- Updated LoginCommandHandler and RegisterTenantCommandHandler to return refresh tokens
- Added POST /api/auth/refresh endpoint (token rotation)
- Added POST /api/auth/logout endpoint (revoke single token)
- Added POST /api/auth/logout-all endpoint (revoke all user tokens)
- Updated JWT access token expiration to 15 minutes (from 60)
- Refresh token expiration set to 7 days
- Security features: token reuse detection, IP address tracking, user-agent logging

Changes:
- Domain: RefreshToken.cs, IRefreshTokenRepository.cs
- Application: IRefreshTokenService.cs, updated LoginResponseDto and RegisterTenantResult
- Infrastructure: RefreshTokenService.cs, RefreshTokenRepository.cs, RefreshTokenConfiguration.cs
- API: AuthController.cs (3 new endpoints), RefreshTokenRequest.cs, LogoutRequest.cs
- Configuration: appsettings.Development.json (updated JWT settings)
- DI: DependencyInjection.cs (registered new services)
- Migration: AddRefreshTokens migration

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:44:36 +01:00
Yaojia Wang
1f66b25f30 In progress
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
2025-11-03 14:00:24 +01:00
Yaojia Wang
fe8ad1c1f9 In progress
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
2025-11-03 11:51:02 +01:00
Yaojia Wang
8caf8c1bcf Project Init
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
2025-11-03 00:04:19 +01:00
Yaojia Wang
014d62bcc2 Project Init
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 23:55:18 +01:00