Téléverser les fichiers vers "/"

This commit is contained in:
2025-10-08 15:00:22 +02:00
parent 373e9b91a5
commit 2f3b6ef1ee
5 changed files with 182 additions and 0 deletions

26
GetAllColorsEndpoint.cs Normal file
View File

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