feat(backend): Implement PendingChange Management (Story 5.10)

Implemented complete Human-in-the-Loop approval workflow for AI-proposed changes:

Changes:
- Created PendingChange DTOs (PendingChangeDto, CreatePendingChangeRequest, ApproveChangeRequest, RejectChangeRequest, PendingChangeFilterDto)
- Implemented IPendingChangeService interface with CRUD, approval/rejection, expiration, and deletion operations
- Implemented PendingChangeService with full workflow support and tenant isolation
- Created McpPendingChangesController REST API with endpoints for listing, approving, rejecting, and deleting pending changes
- Implemented PendingChangeApprovedEventHandler to execute approved changes via MediatR commands (Project, Epic, Story, Task CRUD operations)
- Created PendingChangeExpirationBackgroundService for auto-expiration of changes after 24 hours
- Registered all services and background service in DI container

Technical Details:
- Status flow: PendingApproval → Approved → Applied (or Rejected/Expired)
- Tenant isolation enforced in all operations
- Domain events published for audit trail
- Event-driven execution using MediatR
- Background service runs every 5 minutes to expire old changes
- JWT authentication required for all endpoints

🤖 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-09 17:58:12 +01:00
parent debfb95780
commit 2fec2df004
11 changed files with 1182 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
namespace ColaFlow.Modules.Mcp.Application.DTOs;
/// <summary>
/// Request to reject a PendingChange
/// </summary>
public class RejectChangeRequest
{
public string Reason { get; set; } = null!;
}