Files
PyroFetes-Sujet1/PyroFetes/Endpoints/PurchaseOrders/GetAllPurchaseOrderEndpoint.cs
T
2026-05-28 15:36:33 +02:00

20 lines
672 B
C#

using FastEndpoints;
using PyroFetes.DTO.PurchaseOrder.Response;
using PyroFetes.Repositories;
using PyroFetes.Specifications.PurchaseOrders;
namespace PyroFetes.Endpoints.PurchaseOrders;
public class GetAllPurchaseOrderEndpoint(PurchaseOrdersRepository purchaseOrdersRepository) : EndpointWithoutRequest<List<GetPurchaseOrderDto>>
{
public override void Configure()
{
Get("/purchaseOrders");
Roles("Admin","Employe");
}
public override async Task HandleAsync(CancellationToken ct)
{
await Send.OkAsync(await purchaseOrdersRepository.ProjectToListAsync<GetPurchaseOrderDto>(new GetAllPurchaseOrderSpec(), ct), ct);
}
}