diff --git a/PF3/Endpoint/Show/CreateShowEndpoint.cs b/PF3/Endpoint/Show/CreateShowEndpoint.cs index a89df07..6d7c9fe 100644 --- a/PF3/Endpoint/Show/CreateShowEndpoint.cs +++ b/PF3/Endpoint/Show/CreateShowEndpoint.cs @@ -10,7 +10,7 @@ public class CreateShowEndpoint(PyroFetesDbContext pyroFetesDbContext):Endpoint< { public override void Configure() { - Post("/api/show"); + Post("/api/shows"); AllowAnonymous(); } diff --git a/PF3/Endpoint/Show/GetShowEndpoint.cs b/PF3/Endpoint/Show/GetShowEndpoint.cs new file mode 100644 index 0000000..070e4fa --- /dev/null +++ b/PF3/Endpoint/Show/GetShowEndpoint.cs @@ -0,0 +1,31 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PF3.DTO.Show.Response; +using PF3.Migrations; + +namespace PF3.Endpoint.Show; + +public class GetShowEndpoint(PyroFetesDbContext pyroFetesDbContext):Endpoint +{ + public override void Configure() + { + Get("/api/shows/{Id}", a=> a.Id!); + AllowAnonymous(); + } + + public override async Task HandleAsync(ReadShowDto req, CancellationToken ct) + { + var show = await pyroFetesDbContext.Shows + .Where(a => a.Id == req.Id) + .Select(a => new ReadShowDto + { + Id = req.Id, + Name = req.Name, + Place = req.Place, + Description = req.Description, + PyrotechnicImplementationPlan = req.PyrotechnicImplementationPlan + }) + .FirstOrDefaultAsync(ct); + await Send.OkAsync(show, ct); + } +} \ No newline at end of file