Files
PF3-fork/PyroFetes/Endpoints/Show/GetAllShowsEndpoint.cs
T
cernont 71b7a53e59 Migrate Show.Date from DateOnly to DateTime to support time of day
Removes DateOnly/DateTime conversion boilerplate from all Show endpoints
and adds the corresponding EF Core migration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 18:01:12 +02:00

33 lines
900 B
C#

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("/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,
CityId = s.CityId
})
.ToListAsync(ct);
await Send.OkAsync(shows, ct);
}
}