using FastEndpoints; using Microsoft.EntityFrameworkCore; using PyroFetes.DTO.SoundTimecode.Response; namespace PyroFetes.Endpoints.SoundTimecode; public class GetAllSoundTimecodesEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest> { 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); } }