using FastEndpoints; using Microsoft.EntityFrameworkCore; using PF3.DTO.Staff.Response; namespace PF3.Endpoints.Staff; public class GetAllStaffEndpoint(PF3DbContext pf3DbContext) : EndpointWithoutRequest> { public override void Configure() { Get("/api/staff"); AllowAnonymous(); } public override async Task HandleAsync(CancellationToken ct) { var staffs = await pf3DbContext.Staffs.ToListAsync(ct); var result = staffs.Select(s => new ReadStaffDto { Id = s.Id, FirstName = s.FirstName, LastName = s.LastName, Profession = s.Profession, Email = s.Email }).ToList(); await Send.OkAsync(result, ct); } }