From d7bc054cb5539c5a4b61eefcc9685b052b11d309 Mon Sep 17 00:00:00 2001 From: kieva Date: Wed, 8 Oct 2025 16:39:54 +0200 Subject: [PATCH] Ajouter PyroFetes/Endpoints/Effect/GetAllEffectsEndpoint --- .../Endpoints/Effect/GetAllEffectsEndpoint | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 PyroFetes/Endpoints/Effect/GetAllEffectsEndpoint diff --git a/PyroFetes/Endpoints/Effect/GetAllEffectsEndpoint b/PyroFetes/Endpoints/Effect/GetAllEffectsEndpoint new file mode 100644 index 0000000..c4f253d --- /dev/null +++ b/PyroFetes/Endpoints/Effect/GetAllEffectsEndpoint @@ -0,0 +1,27 @@ +using API.DTO.Effect.Response; +using FastEndpoints; +using Microsoft.EntityFrameworkCore; + +namespace API.Endpoints.Effect; + +public class GetAllEffectsEndpoint(AppDbContext appDbContext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/effects"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + List responseDto = await appDbContext.Effects + .Select(a => new GetEffectDto + { + Id = a.Id, + Label = a.Label, + } + ).ToListAsync(ct); + + await Send.OkAsync(responseDto, ct); + } +} \ No newline at end of file