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 TaskDeletedEvent - sends SignalR notification
///
public class TaskDeletedEventHandler(
IProjectNotificationService notificationService,
ILogger logger)
: INotificationHandler
{
public async Task Handle(TaskDeletedEvent notification, CancellationToken cancellationToken)
{
logger.LogInformation("Handling TaskDeletedEvent for task {TaskId}", notification.TaskId);
await notificationService.NotifyTaskDeleted(
notification.TenantId.Value,
notification.ProjectId.Value,
notification.StoryId.Value,
notification.TaskId.Value);
logger.LogInformation("SignalR notification sent for task {TaskId}", notification.TaskId);
}
}