customer type + communication added

This commit is contained in:
2025-12-04 16:42:15 +01:00
parent a554693e9c
commit 6908112755
14 changed files with 102 additions and 24 deletions

View File

@@ -0,0 +1,27 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PyroFetes.DTO.Communication.Response;
namespace PyroFetes.Endpoints.Communication;
public class GetAllCommunicationsEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest<List<GetCommunicationDto>>
{
public override void Configure()
{
Get ("/api/communications");
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);
}
}