From 7364a75a2cb4dd1912dfc909fbd0a2e7cc622490 Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Sat, 21 Feb 2026 18:44:17 +0100 Subject: [PATCH] Created designation endpoint --- .../DTO/Designations/GetDesignationDto.cs | 7 +++++++ .../GetAllDesignationsEndpoint.cs | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 BeReadyBackend/DTO/Designations/GetDesignationDto.cs create mode 100644 BeReadyBackend/Endpoints/Designations/GetAllDesignationsEndpoint.cs diff --git a/BeReadyBackend/DTO/Designations/GetDesignationDto.cs b/BeReadyBackend/DTO/Designations/GetDesignationDto.cs new file mode 100644 index 0000000..19fe43b --- /dev/null +++ b/BeReadyBackend/DTO/Designations/GetDesignationDto.cs @@ -0,0 +1,7 @@ +namespace BeReadyBackend.DTO.Designations; + +public class GetDesignationDto +{ + public int Id { get; set; } + public string? Label { get; set; } +} \ No newline at end of file diff --git a/BeReadyBackend/Endpoints/Designations/GetAllDesignationsEndpoint.cs b/BeReadyBackend/Endpoints/Designations/GetAllDesignationsEndpoint.cs new file mode 100644 index 0000000..03b405d --- /dev/null +++ b/BeReadyBackend/Endpoints/Designations/GetAllDesignationsEndpoint.cs @@ -0,0 +1,19 @@ +using BeReadyBackend.DTO.Designations; +using BeReadyBackend.Repositories; +using FastEndpoints; + +namespace BeReadyBackend.Endpoints.Designations; + +public class GetAllDesignationsEndpoint(DesignationsRepository designationsRepository) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/Designations/"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + await Send.OkAsync(await designationsRepository.ProjectToListAsync(ct), ct); + } +} \ No newline at end of file