71b7a53e59
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>
33 lines
900 B
C#
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);
|
|
}
|
|
}
|