Finalisation endpoints

This commit is contained in:
2025-11-13 15:11:34 +01:00
parent 5c12a45ae6
commit 3a09bfc8ad
20 changed files with 922 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PyroFetes.DTO.Show.Response;
namespace PyroFetes.Endpoints.Show;
public class GetAllShowsEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest<List<ReadShowDto>>
{
public override void Configure()
{
Get("/api/shows");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
var shows = await pyroFetesDbContext.Shows
.Select(s => new ReadShowDto
{
Id = s.Id,
Name = s.Name,
Place = s.Place,
Description = s.Description,
PyrotechnicImplementationPlan = s.PyrotechnicImplementationPlan,
Date = s.Date.HasValue ? s.Date.Value.ToDateTime(TimeOnly.MinValue) : null
})
.ToListAsync(ct);
await Send.OkAsync(shows, ct);
}
}