Extends SignalR notification system to cover all ProjectManagement CRUD operations:
Domain Events Created:
- EpicUpdatedEvent, EpicDeletedEvent
- StoryCreatedEvent, StoryUpdatedEvent, StoryDeletedEvent
- TaskCreatedEvent, TaskUpdatedEvent, TaskDeletedEvent, TaskAssignedEvent
Event Handlers Added (10 handlers):
- EpicCreatedEventHandler, EpicUpdatedEventHandler, EpicDeletedEventHandler
- StoryCreatedEventHandler, StoryUpdatedEventHandler, StoryDeletedEventHandler
- TaskCreatedEventHandler, TaskUpdatedEventHandler, TaskDeletedEventHandler
- TaskAssignedEventHandler
Infrastructure Extensions:
- Extended IProjectNotificationService with Epic/Story/Task methods
- Extended IRealtimeNotificationService with Epic/Story/Task methods
- Extended RealtimeNotificationService with implementations
- Extended ProjectNotificationServiceAdapter for delegation
Domain Changes:
- Updated EpicCreatedEvent to include TenantId (consistency with other events)
- Added Epic/Story/Task CRUD methods to Project aggregate root
- All operations raise appropriate domain events
Broadcasting Strategy:
- Created events: Broadcast to both project-{projectId} and tenant-{tenantId} groups
- Updated events: Broadcast to project-{projectId} group only
- Deleted events: Broadcast to project-{projectId} group only
- Assigned events: Broadcast to project-{projectId} group with assignment details
Test Results:
- All 192 domain tests passing
- Domain and Application layers compile successfully
- Event handlers auto-registered by MediatR
Files Changed:
- 9 new domain event files
- 10 new event handler files
- 3 service interfaces extended
- 2 service implementations extended
- 1 aggregate updated with event raising logic
- 1 test file updated for new event signature
Status: Complete real-time collaboration for ProjectManagement module
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
47 lines
1.6 KiB
C#
47 lines
1.6 KiB
C#
using MediatR;
|
|
using Microsoft.Extensions.Logging;
|
|
using ColaFlow.Modules.ProjectManagement.Domain.Events;
|
|
using ColaFlow.Modules.ProjectManagement.Application.Services;
|
|
|
|
namespace ColaFlow.Modules.ProjectManagement.Application.EventHandlers;
|
|
|
|
/// <summary>
|
|
/// Handler for StoryCreatedEvent - sends SignalR notification
|
|
/// </summary>
|
|
public class StoryCreatedEventHandler : INotificationHandler<StoryCreatedEvent>
|
|
{
|
|
private readonly IProjectNotificationService _notificationService;
|
|
private readonly ILogger<StoryCreatedEventHandler> _logger;
|
|
|
|
public StoryCreatedEventHandler(
|
|
IProjectNotificationService notificationService,
|
|
ILogger<StoryCreatedEventHandler> logger)
|
|
{
|
|
_notificationService = notificationService;
|
|
_logger = logger;
|
|
}
|
|
|
|
public async Task Handle(StoryCreatedEvent notification, CancellationToken cancellationToken)
|
|
{
|
|
_logger.LogInformation("Handling StoryCreatedEvent for story {StoryId}", notification.StoryId);
|
|
|
|
var storyData = new
|
|
{
|
|
Id = notification.StoryId.Value,
|
|
ProjectId = notification.ProjectId.Value,
|
|
EpicId = notification.EpicId.Value,
|
|
Title = notification.StoryTitle,
|
|
CreatedAt = DateTime.UtcNow
|
|
};
|
|
|
|
await _notificationService.NotifyStoryCreated(
|
|
notification.TenantId.Value,
|
|
notification.ProjectId.Value,
|
|
notification.EpicId.Value,
|
|
notification.StoryId.Value,
|
|
storyData);
|
|
|
|
_logger.LogInformation("SignalR notification sent for story {StoryId}", notification.StoryId);
|
|
}
|
|
}
|