Files
PyroFetes-Sujet1/PyroFetes/Endpoints/Users/GetAllUsersEndpoint.cs
2025-11-20 15:38:53 +01:00

20 lines
547 B
C#

using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PyroFetes.DTO.User.Response;
using PyroFetes.Repositories;
namespace PyroFetes.Endpoints.Users;
public class GetAllUsersEndpoint(UsersRepository usersRepository) : EndpointWithoutRequest<List<GetUserDto>>
{
public override void Configure()
{
Get("/api/users");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
await Send.OkAsync(await usersRepository.ProjectToListAsync<GetUserDto>(ct), ct);
}
}