commentaire endpoint

This commit is contained in:
2025-11-05 22:38:55 +01:00
parent 4c0e7df9de
commit 3c32baac57
45 changed files with 475 additions and 479 deletions

View File

@@ -8,21 +8,21 @@ public class GetAllClassificationsEndpoint(PyroFetesDbContext pyrofetesdbcontext
{
public override void Configure()
{
Get("/api/classifications");
AllowAnonymous();
Get("/api/classifications"); //Endpoint qui affiche toutes les classifications
AllowAnonymous(); //Autorise l'accès sans authentification
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetClassificationDto> responseDto = await pyrofetesdbcontext.Classifications
.Select(a => new GetClassificationDto
List<GetClassificationDto> responseDto = await pyrofetesdbcontext.Classifications //Création d'une liste qui récupère toutes les classifications dans la bdd
.Select(a => new GetClassificationDto //Sélectionne dans la liste chaque classification
{
Id = a.Id,
Label = a.Label,
Id = a.Id, //Récupère l'id
Label = a.Label, //Récupère le label
}
).ToListAsync(ct);
).ToListAsync(ct); //Retourne la liste de classification
await Send.OkAsync(responseDto, ct);
await Send.OkAsync(responseDto, ct); //Envoie de la réponse réussite 200 au client
}
}