21 lines
672 B
C#
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);
|
|
}
|
|
} |