Implemented caching on all get endpoints and service layer
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using PostFundManagement.Application.Abstractions.Services;
|
||||
using PostFundManagement.Application.Extensions;
|
||||
using PostFundManagement.Application.Services.Projects;
|
||||
using PostFundManagement.Domain.Abstractions;
|
||||
using PostFundManagement.Domain.Errors;
|
||||
using PostFundManagement.Domain.Extensions;
|
||||
@@ -15,7 +15,7 @@ public class GetProjectRisksEndpoint : IEndpoint
|
||||
public void Map(IEndpointRouteBuilder builder)
|
||||
{
|
||||
builder.MapGet("api/projects/{projectId}/risks", async (string projectId,
|
||||
ProjectService service, CancellationToken cancellationToken = default) =>
|
||||
IProjectService service, CancellationToken cancellationToken = default) =>
|
||||
await service.GetProjectRisksAsync(projectId, cancellationToken) switch
|
||||
{
|
||||
{ IsSuccess: true, Value: var risks } => Results.Ok(risks),
|
||||
@@ -30,6 +30,7 @@ public class GetProjectRisksEndpoint : IEndpoint
|
||||
.Produces(StatusCodes.Status403Forbidden)
|
||||
.Produces(StatusCodes.Status401Unauthorized)
|
||||
.Produces<Problems>(StatusCodes.Status500InternalServerError)
|
||||
.WithTags(EndpointTags.Projects);
|
||||
.WithTags(EndpointTags.Projects)
|
||||
.CacheOutput();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user