Files
PyroFetes-Sujet1/PyroFetes/Endpoints/Deliverers/GetAllDelivererEndpoint.cs
2025-11-20 16:33:56 +01:00

23 lines
624 B
C#

using AutoMapper.QueryableExtensions;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PyroFetes.DTO.Deliverer.Response;
using PyroFetes.Repositories;
namespace PyroFetes.Endpoints.Deliverers;
public class GetAllDelivererEndpoint(DeliverersRepository deliverersRepository) : EndpointWithoutRequest<List<GetDelivererDto>>
{
public override void Configure()
{
Get("/deliverers");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
await Send.OkAsync(await deliverersRepository.ProjectToListAsync<GetDelivererDto>(ct), ct);
}
}