From 15f04e56c2c5145c5a134e203d0b099dffcbe832 Mon Sep 17 00:00:00 2001 From: Arne Dumarey Date: Wed, 30 Oct 2024 09:30:09 +0100 Subject: [PATCH] fix: toggle oslo endpoints indepentently --- .../Address/Oslo/AddressController-Search.cs | 2 +- .../Infrastructure/FeatureToggleConvention.cs | 31 ------------------- 2 files changed, 1 insertion(+), 32 deletions(-) diff --git a/src/Public.Api/Address/Oslo/AddressController-Search.cs b/src/Public.Api/Address/Oslo/AddressController-Search.cs index 3eebc4b53..ae5d1f576 100644 --- a/src/Public.Api/Address/Oslo/AddressController-Search.cs +++ b/src/Public.Api/Address/Oslo/AddressController-Search.cs @@ -43,7 +43,6 @@ public partial class AddressOsloController /// Als het gevraagde formaat niet beschikbaar is. /// Als het aantal requests per seconde de limiet overschreven heeft. /// Als er een interne fout is opgetreden. - [HttpGet("adressen/zoeken", Name = nameof(SearchAddresses))] [ApiOrder(ApiOrder.Address.V2 + 5)] [ApiProduces(EndpointType.Json)] [ProducesResponseType(typeof(AddressSearchResponse), StatusCodes.Status200OK)] @@ -60,6 +59,7 @@ public partial class AddressOsloController [SwaggerResponseExample(StatusCodes.Status500InternalServerError, typeof(InternalServerErrorResponseExamplesV2))] [HttpCacheValidation(NoCache = true, MustRevalidate = true, ProxyRevalidate = true)] [HttpCacheExpiration(CacheLocation = CacheLocation.Private, MaxAge = DefaultListCaching, NoStore = true, NoTransform = true)] + [HttpGet("adressen/zoeken", Name = nameof(SearchAddresses))] public async Task SearchAddresses( [FromQuery(Name = "q")] string? query, [FromQuery(Name="gemeenteOfPostNaam")] string? municipalityOrPostalName, diff --git a/src/Public.Api/Infrastructure/FeatureToggleConvention.cs b/src/Public.Api/Infrastructure/FeatureToggleConvention.cs index 2d078fa33..32cdf6168 100644 --- a/src/Public.Api/Infrastructure/FeatureToggleConvention.cs +++ b/src/Public.Api/Infrastructure/FeatureToggleConvention.cs @@ -24,40 +24,9 @@ public void Apply(ActionModel action) return; } - var ns = action.DisplayName.Split('.'); - if (ToggleOslo(action, ns)) - return; - - if (ToggleTicketing(action, ns)) - return; - action.ApiExplorer.IsVisible = FeatureIsEnabled(GetPossibleFeatureToggleKeys(action)); } - private bool ToggleOslo(ActionModel action, string[] ns) - { - if (ns.Length <= 2 || ns[3] != "Oslo") - { - return false; - } - - var featureName = $"Is{ns[2]}OsloApiEnabled"; - action.ApiExplorer.IsVisible = FeatureIsEnabled(featureName); - return true; - } - - private bool ToggleTicketing(ActionModel action, string[] ns) - { - if (ns.Length <= 1 || ns[2] != "Tickets") - { - return false; - } - - const string featureName = "Ticketing"; - action.ApiExplorer.IsVisible = FeatureIsEnabled(featureName); - return true; - } - private bool FeatureIsEnabled(string key) { return !_features.ContainsKey(key) ||