Created designation endpoint
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
namespace BeReadyBackend.DTO.Designations;
|
||||
|
||||
public class GetDesignationDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string? Label { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using BeReadyBackend.DTO.Designations;
|
||||
using BeReadyBackend.Repositories;
|
||||
using FastEndpoints;
|
||||
|
||||
namespace BeReadyBackend.Endpoints.Designations;
|
||||
|
||||
public class GetAllDesignationsEndpoint(DesignationsRepository designationsRepository) : EndpointWithoutRequest<List<GetDesignationDto>>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/Designations/");
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CancellationToken ct)
|
||||
{
|
||||
await Send.OkAsync(await designationsRepository.ProjectToListAsync<GetDesignationDto>(ct), ct);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user