using MediatR;
using Microsoft.Extensions.Logging;
using ColaFlow.Modules.ProjectManagement.Domain.Events;
using ColaFlow.Modules.ProjectManagement.Application.Services;
namespace ColaFlow.Modules.ProjectManagement.Application.EventHandlers;
///
/// Handler for EpicUpdatedEvent - sends SignalR notification
///
public class EpicUpdatedEventHandler(
IProjectNotificationService notificationService,
ILogger logger)
: INotificationHandler
{
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);
}
}