using ChapterX.Domain.Repositories; using MediatR; using Microsoft.Extensions.Logging; namespace ChapterX.Application.Notification.Commands { public class AddHandler : IRequestHandler { private readonly INotificationRepository _notificationRepository; private readonly ILogger _logger; public AddHandler(INotificationRepository notificationRepository, ILogger logger) { _notificationRepository = notificationRepository; _logger = logger; } public async Task Handle(AddRequest request, CancellationToken cancellationToken) { var notification = new Domain.Entities.Notification { Content = request.Content, IsRead = false, CreatedAt = DateTime.UtcNow }; await _notificationRepository.AddAsync(notification, cancellationToken); return new AddResponse(notification.Id); } } }