using Diligent.WebAPI.Business.Interfaces;
using Diligent.WebAPI.Host.Mediator.Request.Queries;
using MediatR;

namespace Diligent.WebAPI.Host.Mediator.Request.Handlers
{
    public class GetAllRequestHandler : IRequestHandler<GetAllRequestsQuery, List<Data.Entities.Request>>
    {
        private readonly IRequestRepository _requestRepository;

        public GetAllRequestHandler(IRequestRepository requestRepository)
        {
            _requestRepository = requestRepository;
        }
        public async Task<List<Data.Entities.Request>> Handle(GetAllRequestsQuery request, CancellationToken cancellationToken) =>
            await _requestRepository.GetAsync();
    }
}
