using API.DTO.Movement.Response; using FastEndpoints; using Microsoft.EntityFrameworkCore; namespace PyroFetes.Endpoints.Movement; public class GetAllMovementsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest> { public override void Configure() { Get("/api/movements"); AllowAnonymous(); } public override async Task HandleAsync(CancellationToken ct) { List responseDto = await pyrofetesdbcontext.Movements .Select(a => new GetMovementDto { Id = a.Id, Date = a.Date, Start = a.Start, Arrival = a.Arrival, Quantity = a.Quantity } ).ToListAsync(ct); await Send.OkAsync(responseDto, ct); } }