Files
PyroFetes-Sujet1/PyroFetes/Endpoints/Products/GetAllProductsUnderLimitEndpoint.cs
2025-12-18 14:41:45 +01:00

21 lines
646 B
C#

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