using CleanArchitecture.Application.Common.Interfaces; using CleanArchitecture.Domain.Users.Events; using MediatR; namespace CleanArchitecture.Application.Reminders.Events; public class ReminderDeletedEventHandler(IRemindersRepository _remindersRepository) : INotificationHandler<ReminderDeletedEvent> { public async Task Handle(ReminderDeletedEvent notification, CancellationToken cancellationToken) { var reminder = await _remindersRepository.GetByIdAsync(notification.ReminderId, cancellationToken) ?? throw new InvalidOperationException(); await _remindersRepository.RemoveAsync(reminder, cancellationToken); } }