using AutoMapper; using Diligent.WebAPI.Business.Interfaces; using Diligent.WebAPI.Host.DTOs.Notification; using Diligent.WebAPI.Host.Mediator.Notifications.Queries; using MediatR; namespace Diligent.WebAPI.Host.Mediator.Notifications.Handlers { public class GetNotificationsHandler : IRequestHandler> { private readonly ICustomerRepository _customerRepository; private readonly IMapper _mapper; public GetNotificationsHandler(ICustomerRepository customerRepository, IMapper mapper) { _customerRepository = customerRepository; _mapper = mapper; } public async Task> Handle(GetNotificationsQuery request, CancellationToken cancellationToken) { return _mapper.Map>(await _customerRepository.ReadNotifications(request.UserId)); } } }