Téléverser les fichiers vers "/"

This commit is contained in:
2025-10-08 15:01:07 +02:00
parent 373e9b91a5
commit 16c87e73dd
5 changed files with 181 additions and 0 deletions

27
GetAllEffectsEndpoint.cs Normal file
View File

@@ -0,0 +1,27 @@
using API.DTO.Effect.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace API.Endpoints.Effect;
public class GetAllEffectsEndpoint(AppDbContext appDbContext) : EndpointWithoutRequest<List<GetEffectDto>>
{
public override void Configure()
{
Get("/effects");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetEffectDto> responseDto = await appDbContext.Effects
.Select(a => new GetEffectDto
{
Id = a.Id,
Label = a.Label,
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}