Adding Comunication
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user