| 12345678910111213141516171819202122232425 |
- 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<GetNotificationsQuery, List<NotificationReadDTO>>
- {
- private readonly ICustomerRepository _customerRepository;
- private readonly IMapper _mapper;
-
- public GetNotificationsHandler(ICustomerRepository customerRepository, IMapper mapper)
- {
- _customerRepository = customerRepository;
- _mapper = mapper;
- }
-
- public async Task<List<NotificationReadDTO>> Handle(GetNotificationsQuery request, CancellationToken cancellationToken)
- {
- return _mapper.Map<List<NotificationReadDTO>>(await _customerRepository.ReadNotifications(request.UserId));
- }
- }
- }
|