Files
PyroFetes/PyroFetes/Endpoints/Users/GetAllUsersEndpoint.cs
2025-11-20 16:33:56 +01:00

20 lines
543 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("/users");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
await Send.OkAsync(await usersRepository.ProjectToListAsync<GetUserDto>(ct), ct);
}
}