29 lines
858 B
C#
29 lines
858 B
C#
using FastEndpoints;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using PyroFetes.DTO.Availability.Response;
|
|
using PyroFetes.DTO.Communication.Response;
|
|
|
|
namespace PyroFetes.Endpoints.Communication;
|
|
|
|
public class GetCommunicationEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest<List<GetCommunicationDto>>
|
|
{
|
|
public override void Configure()
|
|
{
|
|
Get ("/api/availabilities");
|
|
AllowAnonymous();
|
|
}
|
|
|
|
public override async Task HandleAsync(CancellationToken ct)
|
|
{
|
|
List<GetCommunicationDto> 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);
|
|
}
|
|
}
|