2024-08-09 21:55:16 +03:30
|
|
|
|
using Netina.Domain.Entities.Warehouses;
|
2023-12-31 19:55:22 +03:30
|
|
|
|
|
2024-04-16 20:01:34 +03:30
|
|
|
|
namespace Netina.Repository.Handlers.Warehouses;
|
2023-12-31 19:55:22 +03:30
|
|
|
|
|
2024-08-09 21:55:16 +03:30
|
|
|
|
public class GetShippingsQueryHandler(IRepositoryWrapper repositoryWrapper)
|
|
|
|
|
|
: IRequestHandler<GetShippingsQuery, List<ShippingSDto>>
|
2023-12-31 19:55:22 +03:30
|
|
|
|
{
|
|
|
|
|
|
public async Task<List<ShippingSDto>> Handle(GetShippingsQuery request, CancellationToken cancellationToken)
|
|
|
|
|
|
{
|
2024-08-09 21:55:16 +03:30
|
|
|
|
return await repositoryWrapper
|
2023-12-31 19:55:22 +03:30
|
|
|
|
.SetRepository<Shipping>()
|
|
|
|
|
|
.TableNoTracking.OrderByDescending(b => b.CreatedAt)
|
2024-02-09 21:43:14 +03:30
|
|
|
|
.Skip(request.Page * 20)
|
|
|
|
|
|
.Take(20)
|
2023-12-31 19:55:22 +03:30
|
|
|
|
.Select(ShippingMapper.ProjectToSDto)
|
|
|
|
|
|
.ToListAsync(cancellationToken);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|