using PostFundManagement.Application.Extensions; using PostFundManagement.Application.Services.Evidence; using PostFundManagement.Domain.Abstractions; using PostFundManagement.Domain.Extensions; using PostFundManagement.Domain.Models; using PostFundManagement.Domain.Security; namespace PostFundManagement.Api.Endpoints.Evidence; [ApiVersionTarget(1)] public class GetProjectIndicatorsEndpoint : IEndpoint { public void Map(IEndpointRouteBuilder builder) { builder.MapGet("api/evidence/indicators/project/{projectId}", async (string projectId, EvidenceService service, CancellationToken cancellationToken = default) => { var result = await service.GetProjectIndicatorsAsync(projectIdHash: projectId, cancellationToken); return result.IsSuccess ? Results.Ok(result.Value) : Results.NotFound(); }) .WithDescription("Get get a detailed list of project indicators") .WithName(typeof(GetProjectIndicatorsEndpoint).ToEndpointName()) .MapToApiVersion(new ApiVersion(1)) .Produces(StatusCodes.Status200OK) .Produces(StatusCodes.Status404NotFound) .Produces(StatusCodes.Status401Unauthorized) .WithTags(EndpointTags.Evidence); } }