Files
pyrofetes-backend/PyroFetes/Endpoints/Products/GetAllProductsEndpoint.cs
T
2026-05-24 17:22:03 +01:00

19 lines
533 B
C#

using FastEndpoints;
using PyroFetes.DTO.Product.Response;
using PyroFetes.Repositories;
namespace PyroFetes.Endpoints.Products;
public class GetAllProductsEndpoint(ProductsRepository productsRepository) : EndpointWithoutRequest<List<GetProductDto>>
{
public override void Configure()
{
Get("/products");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
await Send.OkAsync(await productsRepository.ProjectToListAsync<GetProductDto>(ct), ct);
}
}