Fixed endpointname uniqueness #22
@@ -14,7 +14,7 @@ public class GetProgrammesEndpoint : IEndpoint
|
|||||||
{
|
{
|
||||||
public void Map(IEndpointRouteBuilder builder)
|
public void Map(IEndpointRouteBuilder builder)
|
||||||
{
|
{
|
||||||
builder.MapGet("api/governance/programmes/{portfolioId}/list", async (string portfolioId, IGovernanceService service,
|
builder.MapGet("api/governance/programmes/{portfolioId}", async (string portfolioId, IGovernanceService service,
|
||||||
CancellationToken cancellationToken = default) =>
|
CancellationToken cancellationToken = default) =>
|
||||||
await service.GetProgrammesAsync(portfolioId, cancellationToken) switch
|
await service.GetProgrammesAsync(portfolioId, cancellationToken) switch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public sealed class GetProgrammesEndpoint : IEndpoint
|
|||||||
var r => Results.InternalServerError(r.Errors.ToProblems())
|
var r => Results.InternalServerError(r.Errors.ToProblems())
|
||||||
})
|
})
|
||||||
.WithDescription("Get a list of all programmes")
|
.WithDescription("Get a list of all programmes")
|
||||||
.WithName(typeof(GetProgrammesEndpoint).ToEndpointName())
|
.WithName(typeof(GetProgrammesEndpoint).ToEndpointName("Projects"))
|
||||||
.MapToApiVersion(new ApiVersion(1))
|
.MapToApiVersion(new ApiVersion(1))
|
||||||
.Produces<Programme[]>(StatusCodes.Status200OK)
|
.Produces<Programme[]>(StatusCodes.Status200OK)
|
||||||
.Produces(StatusCodes.Status404NotFound)
|
.Produces(StatusCodes.Status404NotFound)
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ public sealed class GovernanceCacheService(GovernanceService service, IDistribut
|
|||||||
public async ValueTask<Result<Programme[]>> GetProgrammesAsync(string portfolioIdHash, CancellationToken cancellationToken = default) =>
|
public async ValueTask<Result<Programme[]>> GetProgrammesAsync(string portfolioIdHash, CancellationToken cancellationToken = default) =>
|
||||||
await Result.Try((Func<ValueTask<Result<Programme[]>>>)(async () =>
|
await Result.Try((Func<ValueTask<Result<Programme[]>>>)(async () =>
|
||||||
{
|
{
|
||||||
var cacheKey = HashService.ToMd5Hash($"getprogrammes").Value;
|
var cacheKey = HashService.ToMd5Hash($"getprogrammes-{portfolioIdHash}").Value;
|
||||||
|
|
||||||
var cached = await cache.GetStringAsync(cacheKey, cancellationToken);
|
var cached = await cache.GetStringAsync(cacheKey, cancellationToken);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user