Files
BeReadyBackend/BeReadyBackend/Endpoints/Users/GetAllUsersEndpoint.cs
T
2026-03-28 15:44:06 +01:00

21 lines
672 B
C#

using BeReadyBackend.DTO.Users;
using BeReadyBackend.Repositories;
using BeReadyBackend.Services;
using BeReadyBackend.Specifications.Users;
using FastEndpoints;
namespace BeReadyBackend.Endpoints.Users;
public class GetAllUsersEndpoint(UsersRepository usersRepository, UserService userService) : EndpointWithoutRequest<List<GetUserDto>>
{
public override void Configure()
{
Get("/Users/");
}
public override async Task HandleAsync(CancellationToken ct)
{
int userId = userService.GetUserIdFromToken();
await Send.OkAsync(await usersRepository.ProjectToListAsync<GetUserDto>(new GetUserNotMeSpec(userId), ct), ct);
}
}