using FastEndpoints; using Microsoft.EntityFrameworkCore; using PyroFetes.DTO.Login.Response; namespace PyroFetes.Endpoints.Login; public class GetAllLoginEndpoint(PyroFetesDbContext database) : EndpointWithoutRequest> { public override void Configure() { Get("/logins"); AllowAnonymous(); } public override async Task HandleAsync(CancellationToken ct) { List logins = await database.Users .Select(login => new GetLoginDto() { Id = login.Id, Name = login.Name, Password = login.Password, Fonction = login.Fonction }) .ToListAsync(ct); await Send.OkAsync(logins, ct); } }