feat(signalr): Add real-time notifications for Epic/Story/Task operations
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>
This commit is contained in:
@@ -59,6 +59,110 @@ public class RealtimeNotificationService : IRealtimeNotificationService
|
||||
await _projectHubContext.Clients.Group(groupName).SendAsync("ProjectUpdated", data);
|
||||
}
|
||||
|
||||
// Epic notifications
|
||||
public async Task NotifyEpicCreated(Guid tenantId, Guid projectId, Guid epicId, object epic)
|
||||
{
|
||||
var projectGroupName = $"project-{projectId}";
|
||||
var tenantGroupName = $"tenant-{tenantId}";
|
||||
|
||||
_logger.LogInformation("Notifying epic {EpicId} created in project {ProjectId}", epicId, projectId);
|
||||
|
||||
await _projectHubContext.Clients.Group(projectGroupName).SendAsync("EpicCreated", epic);
|
||||
await _projectHubContext.Clients.Group(tenantGroupName).SendAsync("EpicCreated", epic);
|
||||
}
|
||||
|
||||
public async Task NotifyEpicUpdated(Guid tenantId, Guid projectId, Guid epicId, object epic)
|
||||
{
|
||||
var projectGroupName = $"project-{projectId}";
|
||||
|
||||
_logger.LogInformation("Notifying epic {EpicId} updated", epicId);
|
||||
|
||||
await _projectHubContext.Clients.Group(projectGroupName).SendAsync("EpicUpdated", epic);
|
||||
}
|
||||
|
||||
public async Task NotifyEpicDeleted(Guid tenantId, Guid projectId, Guid epicId)
|
||||
{
|
||||
var projectGroupName = $"project-{projectId}";
|
||||
|
||||
_logger.LogInformation("Notifying epic {EpicId} deleted", epicId);
|
||||
|
||||
await _projectHubContext.Clients.Group(projectGroupName).SendAsync("EpicDeleted", new { EpicId = epicId });
|
||||
}
|
||||
|
||||
// Story notifications
|
||||
public async Task NotifyStoryCreated(Guid tenantId, Guid projectId, Guid epicId, Guid storyId, object story)
|
||||
{
|
||||
var projectGroupName = $"project-{projectId}";
|
||||
var tenantGroupName = $"tenant-{tenantId}";
|
||||
|
||||
_logger.LogInformation("Notifying story {StoryId} created in epic {EpicId}", storyId, epicId);
|
||||
|
||||
await _projectHubContext.Clients.Group(projectGroupName).SendAsync("StoryCreated", story);
|
||||
await _projectHubContext.Clients.Group(tenantGroupName).SendAsync("StoryCreated", story);
|
||||
}
|
||||
|
||||
public async Task NotifyStoryUpdated(Guid tenantId, Guid projectId, Guid epicId, Guid storyId, object story)
|
||||
{
|
||||
var projectGroupName = $"project-{projectId}";
|
||||
|
||||
_logger.LogInformation("Notifying story {StoryId} updated", storyId);
|
||||
|
||||
await _projectHubContext.Clients.Group(projectGroupName).SendAsync("StoryUpdated", story);
|
||||
}
|
||||
|
||||
public async Task NotifyStoryDeleted(Guid tenantId, Guid projectId, Guid epicId, Guid storyId)
|
||||
{
|
||||
var projectGroupName = $"project-{projectId}";
|
||||
|
||||
_logger.LogInformation("Notifying story {StoryId} deleted", storyId);
|
||||
|
||||
await _projectHubContext.Clients.Group(projectGroupName).SendAsync("StoryDeleted", new { StoryId = storyId });
|
||||
}
|
||||
|
||||
// Task notifications
|
||||
public async Task NotifyTaskCreated(Guid tenantId, Guid projectId, Guid storyId, Guid taskId, object task)
|
||||
{
|
||||
var projectGroupName = $"project-{projectId}";
|
||||
var tenantGroupName = $"tenant-{tenantId}";
|
||||
|
||||
_logger.LogInformation("Notifying task {TaskId} created in story {StoryId}", taskId, storyId);
|
||||
|
||||
await _projectHubContext.Clients.Group(projectGroupName).SendAsync("TaskCreated", task);
|
||||
await _projectHubContext.Clients.Group(tenantGroupName).SendAsync("TaskCreated", task);
|
||||
}
|
||||
|
||||
public async Task NotifyTaskUpdated(Guid tenantId, Guid projectId, Guid storyId, Guid taskId, object task)
|
||||
{
|
||||
var projectGroupName = $"project-{projectId}";
|
||||
|
||||
_logger.LogInformation("Notifying task {TaskId} updated", taskId);
|
||||
|
||||
await _projectHubContext.Clients.Group(projectGroupName).SendAsync("TaskUpdated", task);
|
||||
}
|
||||
|
||||
public async Task NotifyTaskDeleted(Guid tenantId, Guid projectId, Guid storyId, Guid taskId)
|
||||
{
|
||||
var projectGroupName = $"project-{projectId}";
|
||||
|
||||
_logger.LogInformation("Notifying task {TaskId} deleted", taskId);
|
||||
|
||||
await _projectHubContext.Clients.Group(projectGroupName).SendAsync("TaskDeleted", new { TaskId = taskId });
|
||||
}
|
||||
|
||||
public async Task NotifyTaskAssigned(Guid tenantId, Guid projectId, Guid taskId, Guid assigneeId)
|
||||
{
|
||||
var projectGroupName = $"project-{projectId}";
|
||||
|
||||
_logger.LogInformation("Notifying task {TaskId} assigned to {AssigneeId}", taskId, assigneeId);
|
||||
|
||||
await _projectHubContext.Clients.Group(projectGroupName).SendAsync("TaskAssigned", new
|
||||
{
|
||||
TaskId = taskId,
|
||||
AssigneeId = assigneeId,
|
||||
AssignedAt = DateTime.UtcNow
|
||||
});
|
||||
}
|
||||
|
||||
public async Task NotifyIssueCreated(Guid tenantId, Guid projectId, object issue)
|
||||
{
|
||||
var groupName = $"project-{projectId}";
|
||||
|
||||
Reference in New Issue
Block a user