Initial commit

This commit is contained in:
2026-05-05 10:39:43 +02:00
commit b590ecdc35
87 changed files with 3934 additions and 0 deletions
@@ -0,0 +1,27 @@
using AutoMapper;
using FastEndpoints;
using MetaCourse.Api.Data;
using MetaCourse.Api.DTOs.Resources;
using Microsoft.EntityFrameworkCore;
namespace MetaCourse.Api.Endpoints.Resources;
public class GetResourcesEndpoint(AppDbContext db, AutoMapper.IMapper mapper) : EndpointWithoutRequest<List<GetResourceDto>>
{
public override void Configure()
{
Get("api/resources");
AllowAnonymous();
Summary(s => s.Summary = "Liste toutes les ressources du catalogue");
}
public override async Task HandleAsync(CancellationToken ct)
{
var resources = await db.Resources
.AsNoTracking()
.OrderByDescending(r => r.CreatedAt)
.ToListAsync(ct);
await SendOkAsync(mapper.Map<List<GetResourceDto>>(resources), ct);
}
}