37 lines
1.2 KiB
C#
37 lines
1.2 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 EpicUpdatedEvent - sends SignalR notification
|
|
/// </summary>
|
|
public class EpicUpdatedEventHandler(
|
|
IProjectNotificationService notificationService,
|
|
ILogger<EpicUpdatedEventHandler> logger)
|
|
: INotificationHandler<EpicUpdatedEvent>
|
|
{
|
|
public async Task Handle(EpicUpdatedEvent notification, CancellationToken cancellationToken)
|
|
{
|
|
logger.LogInformation("Handling EpicUpdatedEvent for epic {EpicId}", notification.EpicId);
|
|
|
|
var epicData = new
|
|
{
|
|
Id = notification.EpicId.Value,
|
|
ProjectId = notification.ProjectId.Value,
|
|
Name = notification.EpicName,
|
|
UpdatedAt = DateTime.UtcNow
|
|
};
|
|
|
|
await notificationService.NotifyEpicUpdated(
|
|
notification.TenantId.Value,
|
|
notification.ProjectId.Value,
|
|
notification.EpicId.Value,
|
|
epicData);
|
|
|
|
logger.LogInformation("SignalR notification sent for epic {EpicId}", notification.EpicId);
|
|
}
|
|
}
|