Files
PyroFetes-Sujet1/PyroFetes/Endpoints/PurchaseOrders/GetAllPurchaseOrderEndpoint.cs
T
2026-05-24 17:22:03 +01:00

19 lines
586 B
C#

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