-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
61 changed files
with
2,128 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
src/Public.Api/Infrastructure/Swagger/ApiDocumentationHiddenConvention.cs
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
src/Public.Api/Infrastructure/Swagger/ApiVisibleActionModelConvention.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace Public.Api.Infrastructure.Swagger; | ||
|
||
using System.Linq; | ||
using System.Reflection; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.ApplicationModels; | ||
|
||
public class ApiVisibleActionModelConvention : IActionModelConvention | ||
{ | ||
public void Apply(ActionModel action) | ||
{ | ||
var actionIgnored = action.ActionMethod.GetCustomAttribute<ApiExplorerSettingsAttribute>()?.IgnoreApi == true; | ||
if (actionIgnored) | ||
{ | ||
return; | ||
} | ||
|
||
var isVisible = action.Controller.ControllerType | ||
.GetCustomAttributes<ApiVisibleAttribute>(true) | ||
.Select(x => x.Visible) | ||
.FirstOrDefault(); | ||
|
||
action.ApiExplorer.IsVisible = isVisible; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Public.Api/Infrastructure/Swagger/ApiVisibleAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Public.Api.Infrastructure.Swagger | ||
{ | ||
using System; | ||
|
||
[AttributeUsage(AttributeTargets.Class)] | ||
public class ApiVisibleAttribute : Attribute | ||
{ | ||
public bool Visible { get; } | ||
|
||
public ApiVisibleAttribute() : this(true) { } | ||
public ApiVisibleAttribute(bool visible) => Visible = visible; | ||
} | ||
} |
43 changes: 0 additions & 43 deletions
43
src/Public.Api/Infrastructure/Swagger/ToggledApiControllerSpec.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/Public.Api/Road/Changes/V2/ChangeFeedController-GetContent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
namespace Public.Api.Road.Changes.V2 | ||
{ | ||
using Be.Vlaanderen.Basisregisters.Api; | ||
using Be.Vlaanderen.Basisregisters.Api.Exceptions; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Public.Api.Infrastructure; | ||
using RestSharp; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
public partial class ChangeFeedControllerV2 | ||
{ | ||
[HttpGet("wegen/activiteit/gebeurtenis/{id}/inhoud", Name = nameof(GetContentV2))] | ||
public async Task<IActionResult> GetContentV2( | ||
[FromRoute] long? id, | ||
[FromServices] ProblemDetailsHelper problemDetailsHelper, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
RestRequest BackendRequest() => | ||
CreateBackendRestRequest(Method.Get, "changefeed/entry/{id}/content") | ||
.AddParameter(nameof(id), id, ParameterType.UrlSegment); | ||
|
||
var response = await GetFromBackendWithBadRequestAsync( | ||
AcceptType.Json, | ||
BackendRequest, | ||
CreateDefaultHandleBadRequest(), | ||
problemDetailsHelper, | ||
cancellationToken: cancellationToken); | ||
return new BackendResponseResult(response); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/Public.Api/Road/Changes/V2/ChangeFeedController-GetHead.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
namespace Public.Api.Road.Changes.V2 | ||
{ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Be.Vlaanderen.Basisregisters.Api; | ||
using Be.Vlaanderen.Basisregisters.Api.Exceptions; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Public.Api.Infrastructure; | ||
using RestSharp; | ||
|
||
public partial class ChangeFeedControllerV2 | ||
{ | ||
[HttpGet("wegen/activiteit/begin", Name = nameof(GetHeadV2))] | ||
public async Task<IActionResult> GetHeadV2( | ||
[FromQuery] int? maxEntryCount, | ||
[FromQuery] string? filter, | ||
[FromServices] ProblemDetailsHelper problemDetailsHelper, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
RestRequest BackendRequest() => | ||
CreateBackendRestRequest(Method.Get, "changefeed/head") | ||
.AddParameter(nameof(maxEntryCount), maxEntryCount, ParameterType.QueryString) | ||
.AddParameter(nameof(filter), filter, ParameterType.QueryString); | ||
|
||
var response = await GetFromBackendWithBadRequestAsync( | ||
AcceptType.Json, | ||
BackendRequest, | ||
CreateDefaultHandleBadRequest(), | ||
problemDetailsHelper, | ||
cancellationToken: cancellationToken); | ||
return new BackendResponseResult(response); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/Public.Api/Road/Changes/V2/ChangeFeedController-GetNext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
namespace Public.Api.Road.Changes.V2 | ||
{ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Be.Vlaanderen.Basisregisters.Api; | ||
using Be.Vlaanderen.Basisregisters.Api.Exceptions; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Public.Api.Infrastructure; | ||
using RestSharp; | ||
|
||
public partial class ChangeFeedControllerV2 | ||
{ | ||
[HttpGet("wegen/activiteit/volgende", Name = nameof(GetNextV2))] | ||
public async Task<IActionResult> GetNextV2( | ||
[FromQuery] long? afterEntry, | ||
[FromQuery] int? maxEntryCount, | ||
[FromQuery] string? filter, | ||
[FromServices] ProblemDetailsHelper problemDetailsHelper, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
RestRequest BackendRequest() => | ||
CreateBackendRestRequest(Method.Get, "changefeed/next") | ||
.AddParameter(nameof(maxEntryCount), maxEntryCount, ParameterType.QueryString) | ||
.AddParameter(nameof(afterEntry), afterEntry, ParameterType.QueryString) | ||
.AddParameter(nameof(filter), filter, ParameterType.QueryString); | ||
|
||
var response = await GetFromBackendWithBadRequestAsync( | ||
AcceptType.Json, | ||
BackendRequest, | ||
CreateDefaultHandleBadRequest(), | ||
problemDetailsHelper, | ||
cancellationToken: cancellationToken); | ||
return new BackendResponseResult(response); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/Public.Api/Road/Changes/V2/ChangeFeedController-GetPrevious.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
namespace Public.Api.Road.Changes.V2 | ||
{ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Be.Vlaanderen.Basisregisters.Api; | ||
using Be.Vlaanderen.Basisregisters.Api.Exceptions; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Public.Api.Infrastructure; | ||
using RestSharp; | ||
|
||
public partial class ChangeFeedControllerV2 | ||
{ | ||
[HttpGet("wegen/activiteit/vorige", Name = nameof(GetPreviousV2))] | ||
public async Task<IActionResult> GetPreviousV2( | ||
[FromQuery] long? beforeEntry, | ||
[FromQuery] int? maxEntryCount, | ||
[FromQuery] string? filter, | ||
[FromServices] ProblemDetailsHelper problemDetailsHelper, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
RestRequest BackendRequest() => | ||
CreateBackendRestRequest(Method.Get, "changefeed/previous") | ||
.AddParameter(nameof(maxEntryCount), maxEntryCount, ParameterType.QueryString) | ||
.AddParameter(nameof(beforeEntry), beforeEntry, ParameterType.QueryString) | ||
.AddParameter(nameof(filter), filter, ParameterType.QueryString); | ||
|
||
var response = await GetFromBackendWithBadRequestAsync( | ||
AcceptType.Json, | ||
BackendRequest, | ||
CreateDefaultHandleBadRequest(), | ||
problemDetailsHelper, | ||
cancellationToken: cancellationToken); | ||
return new BackendResponseResult(response); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
namespace Public.Api.Road.Changes.V2 | ||
{ | ||
using Asp.Versioning; | ||
using Autofac.Features.AttributeFilters; | ||
using Be.Vlaanderen.Basisregisters.Api; | ||
using Common.Infrastructure; | ||
using FeatureToggle; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Infrastructure; | ||
using Microsoft.Extensions.Logging; | ||
using Public.Api.Infrastructure.Configuration; | ||
using Public.Api.Infrastructure.Swagger; | ||
using Public.Api.Infrastructure.Version; | ||
|
||
[ApiVersion(Version.V2)] | ||
[AdvertiseApiVersions(Version.CurrentAdvertised)] | ||
[ApiRoute("")] | ||
[ApiExplorerSettings(GroupName = "Activiteit")] | ||
[ApiOrder(ApiOrder.Road.ChangeFeed)] | ||
public partial class ChangeFeedControllerV2 : RoadRegistryApiController<ChangeFeedControllerV2> | ||
{ | ||
protected override string NotFoundExceptionMessage => "Onbestaande activiteit."; | ||
protected override string GoneExceptionMessage => "Verwijderde activiteit."; | ||
|
||
public ChangeFeedControllerV2( | ||
IHttpContextAccessor httpContextAccessor, | ||
IActionContextAccessor actionContextAccessor, | ||
[KeyFilter(RegistryKeys.Road)] IRestClient restClient, | ||
[KeyFilter(RegistryKeys.Road)] IFeatureToggle cacheToggle, | ||
ConnectionMultiplexerProvider redis, | ||
ILogger<ChangeFeedControllerV2> logger) | ||
: base(httpContextAccessor, redis, logger, restClient, cacheToggle, actionContextAccessor) { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.