using FastEndpoints; using Microsoft.EntityFrameworkCore; using PyroFetes.DTO.Communication.Response; namespace PyroFetes.Endpoints.Communication; public class GetAllCommunicationsEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest> { public override void Configure() { Get ("/communications"); AllowAnonymous(); } public override async Task HandleAsync(CancellationToken ct) { List communications = await pyroFetesDbContext.Communications.Select(x => new GetCommunicationDto() { Id = x.Id, Calling = x.Calling, Email = x.Email, Meeting = x.Meeting, }).ToListAsync(ct); await Send.OkAsync(communications, ct); } }