Files
PF3-fork/PyroFetes/Endpoints/SoundTimecode/GetAllSoundTimecodesEndpoint.cs
2025-11-13 15:11:34 +01:00

30 lines
851 B
C#

using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PyroFetes.DTO.SoundTimecode.Response;
namespace PyroFetes.Endpoints.SoundTimecode;
public class GetAllSoundTimecodesEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest<List<ReadSoundTimecodeDto>>
{
public override void Configure()
{
Get("/api/soundtimecodes");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
var soundTimecodes = await pyroFetesDbContext.SoundTimecodes
.Select(st => new ReadSoundTimecodeDto
{
ShowId = st.ShowId,
SoundId = st.SoundId,
Start = (int)st.Start,
End = (int)st.End
})
.ToListAsync(ct);
await Send.OkAsync(soundTimecodes, ct);
}
}