Finalisation endpoints
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user