From b14c70de84fe22f027448c2cada4e42df112acaf Mon Sep 17 00:00:00 2001 From: ArneD Date: Thu, 22 Aug 2024 13:54:08 +0200 Subject: [PATCH] feat: remove api legacy --- .github/workflows/release.yml | 46 +-- PostalRegistry.sln | 7 - .../Convertors/Language.cs | 26 -- .../Convertors/PostalInformationName.cs | 12 - .../Convertors/PostalInformationStatus.cs | 20 -- src/PostalRegistry.Api.Legacy/Dockerfile | 30 -- .../AtomFeedConfigurationBuilder.cs | 37 -- .../AddNoCacheHeadersMiddleware.cs | 25 -- .../Infrastructure/EmptyController.cs | 20 -- .../Infrastructure/Modules/ApiModule.cs | 41 --- .../Infrastructure/Options/ResponseOptions.cs | 12 - .../Infrastructure/Program.cs | 30 -- .../Infrastructure/Startup.cs | 163 --------- .../PostalInformationController.cs | 321 ------------------ .../Query/PostalInformationListQuery.cs | 73 ---- .../PostalInformationSyndicationQuery.cs | 240 ------------- .../PostalInformationListResponse.cs | 120 ------- .../Responses/PostalInformationResponse.cs | 118 ------- .../PostalInformationSyndicationResponse.cs | 240 ------------- .../Responses/TotalCountResponseExample.cs | 16 - .../PostalRegistry.Api.Legacy.csproj | 41 --- ...stalRegistry.Api.Legacy.csproj.DotSettings | 2 - .../Properties/AssemblyInfo.cs | 10 - .../Properties/launchSettings.json | 26 -- .../appsettings.json | 58 ---- src/PostalRegistry.Api.Legacy/init.sh | 7 - .../paket.references | 10 - src/PostalRegistry.Api.Legacy/paket.template | 38 --- 28 files changed, 1 insertion(+), 1788 deletions(-) delete mode 100755 src/PostalRegistry.Api.Legacy/Convertors/Language.cs delete mode 100755 src/PostalRegistry.Api.Legacy/Convertors/PostalInformationName.cs delete mode 100755 src/PostalRegistry.Api.Legacy/Convertors/PostalInformationStatus.cs delete mode 100644 src/PostalRegistry.Api.Legacy/Dockerfile delete mode 100644 src/PostalRegistry.Api.Legacy/Infrastructure/AtomFeedConfigurationBuilder.cs delete mode 100755 src/PostalRegistry.Api.Legacy/Infrastructure/Configuration/AddNoCacheHeadersMiddleware.cs delete mode 100755 src/PostalRegistry.Api.Legacy/Infrastructure/EmptyController.cs delete mode 100755 src/PostalRegistry.Api.Legacy/Infrastructure/Modules/ApiModule.cs delete mode 100755 src/PostalRegistry.Api.Legacy/Infrastructure/Options/ResponseOptions.cs delete mode 100755 src/PostalRegistry.Api.Legacy/Infrastructure/Program.cs delete mode 100755 src/PostalRegistry.Api.Legacy/Infrastructure/Startup.cs delete mode 100755 src/PostalRegistry.Api.Legacy/PostalInformation/PostalInformationController.cs delete mode 100755 src/PostalRegistry.Api.Legacy/PostalInformation/Query/PostalInformationListQuery.cs delete mode 100755 src/PostalRegistry.Api.Legacy/PostalInformation/Query/PostalInformationSyndicationQuery.cs delete mode 100755 src/PostalRegistry.Api.Legacy/PostalInformation/Responses/PostalInformationListResponse.cs delete mode 100755 src/PostalRegistry.Api.Legacy/PostalInformation/Responses/PostalInformationResponse.cs delete mode 100755 src/PostalRegistry.Api.Legacy/PostalInformation/Responses/PostalInformationSyndicationResponse.cs delete mode 100644 src/PostalRegistry.Api.Legacy/PostalInformation/Responses/TotalCountResponseExample.cs delete mode 100755 src/PostalRegistry.Api.Legacy/PostalRegistry.Api.Legacy.csproj delete mode 100755 src/PostalRegistry.Api.Legacy/PostalRegistry.Api.Legacy.csproj.DotSettings delete mode 100755 src/PostalRegistry.Api.Legacy/Properties/AssemblyInfo.cs delete mode 100755 src/PostalRegistry.Api.Legacy/Properties/launchSettings.json delete mode 100755 src/PostalRegistry.Api.Legacy/appsettings.json delete mode 100755 src/PostalRegistry.Api.Legacy/init.sh delete mode 100755 src/PostalRegistry.Api.Legacy/paket.references delete mode 100755 src/PostalRegistry.Api.Legacy/paket.template diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e76ed1d9..bc2d294c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,21 +55,6 @@ jobs: echo RELEASE_VERSION=$(cat semver) >> $GITHUB_ENV shell: bash - build-api-legacy: - name: Build Api Legacy - uses: Informatievlaanderen/build-pipeline/.github/workflows/build-image.yml@main - needs: [ set-release-version ] - if: ${{ (github.repository_owner == 'Informatievlaanderen') && (needs.set-release-version.outputs.version != 'none') }} - with: - registry: ${{ vars.VBR_DEVOPS_DOCKER_REGISTRY }}/postal-registry - image-file: pr-api-legacy-image.tar - image-name: api-legacy - test-project: PostalRegistry.Tests - build-project: PostalRegistry.Api.Legacy - semver: ${{ needs.set-release-version.outputs.version }} - dotnet-version: ${{ vars.VBR_DOTNET_VERSION_8 }} - secrets: inherit - build-api-oslo: name: Build Api Oslo uses: Informatievlaanderen/build-pipeline/.github/workflows/build-image.yml@main @@ -175,19 +160,6 @@ jobs: dotnet-version: ${{ vars.VBR_DOTNET_VERSION_8 }} secrets: inherit - pack-api-legacy: - name: Pack Api Legacy - uses: Informatievlaanderen/build-pipeline/.github/workflows/pack.yml@main - needs: [ set-release-version ] - if: ${{ (github.repository_owner == 'Informatievlaanderen') && (needs.set-release-version.outputs.version != 'none') }} - with: - pack-file: Be.Vlaanderen.Basisregisters.PostalRegistry.Api.Legacy - test-project: PostalRegistry.Tests - build-project: PostalRegistry.Api.Legacy - semver: ${{ needs.set-release-version.outputs.version }} - dotnet-version: ${{ vars.VBR_DOTNET_VERSION_8 }} - secrets: inherit - pack-api-oslo: name: Pack Api Oslo uses: Informatievlaanderen/build-pipeline/.github/workflows/pack.yml@main @@ -219,10 +191,8 @@ jobs: name: Semantic Release runs-on: ubuntu-latest needs: [ set-release-version, - pack-api-legacy, pack-api-oslo, pack-api-extract, - build-api-legacy, build-api-oslo, build-api-extract, build-api-import, @@ -284,13 +254,6 @@ jobs: python -m pip install --upgrade pip pip install requests markdown argparse - - name: Download NuGet Api Legacy - uses: actions/download-artifact@v4 - continue-on-error: false - with: - name: nuget-Be.Vlaanderen.Basisregisters.PostalRegistry.Api.Legacy-${{ needs.set-release-version.outputs.version }} - path: dist/nuget/ - - name: Download NuGet Api Oslo uses: actions/download-artifact@v4 continue-on-error: false @@ -347,12 +310,6 @@ jobs: shell: bash run: dotnet --info - - name: Download NuGet package api-legacy - uses: actions/download-artifact@v4 - with: - name: nuget-Be.Vlaanderen.Basisregisters.PostalRegistry.Api.Legacy-${{ needs.release.outputs.version }} - path: ~/ - - name: Download NuGet package api-oslo uses: actions/download-artifact@v4 with: @@ -368,7 +325,6 @@ jobs: - name: Publish packages to NuGet shell: bash run: | - dotnet nuget push ~/Be.Vlaanderen.Basisregisters.PostalRegistry.Api.Legacy.$SEMVER.nupkg --source nuget.org --api-key $NUGET_API_KEY dotnet nuget push ~/Be.Vlaanderen.Basisregisters.PostalRegistry.Api.Oslo.$SEMVER.nupkg --source nuget.org --api-key $NUGET_API_KEY dotnet nuget push ~/Be.Vlaanderen.Basisregisters.PostalRegistry.Api.Extract.$SEMVER.nupkg --source nuget.org --api-key $NUGET_API_KEY env: @@ -444,7 +400,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - image: ['api-legacy', 'api-oslo', 'api-import', 'api-extract', 'projections-syndication', 'projector', 'producer', 'producer-snapshot-oslo'] + image: ['api-oslo', 'api-import', 'api-extract', 'projections-syndication', 'projector', 'producer', 'producer-snapshot-oslo'] steps: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4.0.2 diff --git a/PostalRegistry.sln b/PostalRegistry.sln index 6e93aebe..f6b9d772 100755 --- a/PostalRegistry.sln +++ b/PostalRegistry.sln @@ -22,8 +22,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{A82FA45A-B EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PostalRegistry", "src\PostalRegistry\PostalRegistry.csproj", "{41821826-401B-4907-9E6D-F90DA4D84BA2}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PostalRegistry.Api.Legacy", "src\PostalRegistry.Api.Legacy\PostalRegistry.Api.Legacy.csproj", "{7F47CB53-84F6-4D0D-8380-306E95E1DE56}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PostalRegistry.Api.Import", "src\PostalRegistry.Api.Import\PostalRegistry.Api.Import.csproj", "{8F47CB53-84F6-4D0D-8380-306E95E1DE56}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PostalRegistry.Infrastructure", "src\PostalRegistry.Infrastructure\PostalRegistry.Infrastructure.csproj", "{488B07C6-FEDE-4F8D-A6E2-A7DFED79BBA1}" @@ -73,10 +71,6 @@ Global {41821826-401B-4907-9E6D-F90DA4D84BA2}.Debug|Any CPU.Build.0 = Debug|Any CPU {41821826-401B-4907-9E6D-F90DA4D84BA2}.Release|Any CPU.ActiveCfg = Release|Any CPU {41821826-401B-4907-9E6D-F90DA4D84BA2}.Release|Any CPU.Build.0 = Release|Any CPU - {7F47CB53-84F6-4D0D-8380-306E95E1DE56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7F47CB53-84F6-4D0D-8380-306E95E1DE56}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7F47CB53-84F6-4D0D-8380-306E95E1DE56}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7F47CB53-84F6-4D0D-8380-306E95E1DE56}.Release|Any CPU.Build.0 = Release|Any CPU {8F47CB53-84F6-4D0D-8380-306E95E1DE56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8F47CB53-84F6-4D0D-8380-306E95E1DE56}.Debug|Any CPU.Build.0 = Debug|Any CPU {8F47CB53-84F6-4D0D-8380-306E95E1DE56}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -147,7 +141,6 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {41821826-401B-4907-9E6D-F90DA4D84BA2} = {81BE6CDF-434E-42AB-9CB1-B5E7A26DC317} - {7F47CB53-84F6-4D0D-8380-306E95E1DE56} = {81BE6CDF-434E-42AB-9CB1-B5E7A26DC317} {8F47CB53-84F6-4D0D-8380-306E95E1DE56} = {81BE6CDF-434E-42AB-9CB1-B5E7A26DC317} {488B07C6-FEDE-4F8D-A6E2-A7DFED79BBA1} = {81BE6CDF-434E-42AB-9CB1-B5E7A26DC317} {8F656DE8-12B1-4FFB-8404-16C17558E448} = {A82FA45A-B77F-48AA-8E30-C2928DCAF7EF} diff --git a/src/PostalRegistry.Api.Legacy/Convertors/Language.cs b/src/PostalRegistry.Api.Legacy/Convertors/Language.cs deleted file mode 100755 index b29f6c92..00000000 --- a/src/PostalRegistry.Api.Legacy/Convertors/Language.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace PostalRegistry.Api.Legacy.Convertors -{ - using Be.Vlaanderen.Basisregisters.GrAr.Legacy; - - public static class LanguageExtensions - { - public static Taal ConvertFromLanguage(this Language language) - { - switch (language) - { - default: - case Language.Dutch: - return Taal.NL; - - case Language.French: - return Taal.FR; - - case Language.German: - return Taal.DE; - - case Language.English: - return Taal.EN; - } - } - } -} diff --git a/src/PostalRegistry.Api.Legacy/Convertors/PostalInformationName.cs b/src/PostalRegistry.Api.Legacy/Convertors/PostalInformationName.cs deleted file mode 100755 index da92284b..00000000 --- a/src/PostalRegistry.Api.Legacy/Convertors/PostalInformationName.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace PostalRegistry.Api.Legacy.Convertors -{ - using Be.Vlaanderen.Basisregisters.GrAr.Legacy; - using Be.Vlaanderen.Basisregisters.GrAr.Legacy.PostInfo; - using Projections.Legacy.PostalInformation; - - public static class PostalInformationNameExtensions - { - public static Postnaam ConvertFromPostalName(this PostalInformationName name) - => new Postnaam(new GeografischeNaam(name.Name, name.Language.ConvertFromLanguage())); - } -} diff --git a/src/PostalRegistry.Api.Legacy/Convertors/PostalInformationStatus.cs b/src/PostalRegistry.Api.Legacy/Convertors/PostalInformationStatus.cs deleted file mode 100755 index 4c75e4e8..00000000 --- a/src/PostalRegistry.Api.Legacy/Convertors/PostalInformationStatus.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace PostalRegistry.Api.Legacy.Convertors -{ - using Be.Vlaanderen.Basisregisters.GrAr.Legacy; - - public static class PostalInformationStatusExtensions - { - public static PostInfoStatus ConvertFromPostalInformationStatus(this PostalInformationStatus postalInformationStatus) - { - switch (postalInformationStatus) - { - case PostalInformationStatus.Retired: - return PostInfoStatus.Gehistoreerd; - - default: - case PostalInformationStatus.Current: - return PostInfoStatus.Gerealiseerd; - } - } - } -} diff --git a/src/PostalRegistry.Api.Legacy/Dockerfile b/src/PostalRegistry.Api.Legacy/Dockerfile deleted file mode 100644 index 6804fda7..00000000 --- a/src/PostalRegistry.Api.Legacy/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -FROM mcr.microsoft.com/dotnet/runtime-deps:8.0.2-bookworm-slim-amd64 - -# create work dir and set permissions as WORKDIR sets permissions as root -RUN mkdir /app && chown -R app:app /app -WORKDIR /app - -LABEL maintainer="Digitaal Vlaanderen " -LABEL registry="postal-registry" - -COPY / /app -WORKDIR /app - -RUN apt-get update && \ - apt-get install curl jq -y && \ - chmod +x ./init.sh - -EXPOSE 3002/tcp -ENV ASPNETCORE_URLS http://*:3002 -ENV CORECLR_ENABLE_PROFILING=1 -ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8} -ENV CORECLR_PROFILER_PATH=/app/datadog/linux-x64/Datadog.Trace.ClrProfiler.Native.so -ENV DD_DOTNET_TRACER_HOME=/app/datadog - -# Run the createLogPath script on Linux to ensure the automatic instrumentation logs are generated without permission issues -RUN /app/datadog/createLogPath.sh - -# switch to created user -USER app - -ENTRYPOINT ["./init.sh"] diff --git a/src/PostalRegistry.Api.Legacy/Infrastructure/AtomFeedConfigurationBuilder.cs b/src/PostalRegistry.Api.Legacy/Infrastructure/AtomFeedConfigurationBuilder.cs deleted file mode 100644 index d79b7b97..00000000 --- a/src/PostalRegistry.Api.Legacy/Infrastructure/AtomFeedConfigurationBuilder.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace PostalRegistry.Api.Legacy.Infrastructure -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using Be.Vlaanderen.Basisregisters.Api.Syndication; - using Microsoft.Extensions.Configuration; - using Microsoft.SyndicationFeed; - using Microsoft.SyndicationFeed.Atom; - - public static class AtomFeedConfigurationBuilder - { - public static AtomFeedConfiguration CreateFrom(IConfigurationSection configuration, DateTimeOffset lastUpdated) - { - return new AtomFeedConfiguration( - configuration["Id"], - configuration["Title"], - configuration["Subtitle"], - configuration["GeneratorTitle"], - configuration["GeneratorUri"], - Assembly.GetEntryAssembly().GetName().Version.ToString(), - configuration["Rights"], - lastUpdated, - new SyndicationPerson(configuration["AuthorName"], configuration["AuthorEmail"], AtomContributorTypes.Author), - new SyndicationLink(new Uri(configuration["Self"]), AtomLinkTypes.Self), - new List(), - configuration - .GetSection("Related") - .GetChildren() - .Select(c => - new SyndicationLink(new Uri(c.Value), AtomLinkTypes.Related)) - .ToList() - ); - } - } -} diff --git a/src/PostalRegistry.Api.Legacy/Infrastructure/Configuration/AddNoCacheHeadersMiddleware.cs b/src/PostalRegistry.Api.Legacy/Infrastructure/Configuration/AddNoCacheHeadersMiddleware.cs deleted file mode 100755 index 94a2ab1e..00000000 --- a/src/PostalRegistry.Api.Legacy/Infrastructure/Configuration/AddNoCacheHeadersMiddleware.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace PostalRegistry.Api.Legacy.Infrastructure.Configuration -{ - using System.Threading.Tasks; - using Microsoft.AspNetCore.Http; - using Microsoft.Net.Http.Headers; - - /// - /// Add headers to the response to prevent any caching. - /// - public class AddNoCacheHeadersMiddleware - { - private readonly RequestDelegate _next; - - public AddNoCacheHeadersMiddleware(RequestDelegate next) => _next = next; - - public Task Invoke(HttpContext context) - { - context.Response.Headers.Add(HeaderNames.CacheControl, "no-store, no-cache, must-revalidate"); - context.Response.Headers.Add(HeaderNames.Pragma, "no-cache"); - context.Response.Headers.Add(HeaderNames.Expires, "0"); - - return _next(context); - } - } -} diff --git a/src/PostalRegistry.Api.Legacy/Infrastructure/EmptyController.cs b/src/PostalRegistry.Api.Legacy/Infrastructure/EmptyController.cs deleted file mode 100755 index a6055784..00000000 --- a/src/PostalRegistry.Api.Legacy/Infrastructure/EmptyController.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace PostalRegistry.Api.Legacy.Infrastructure -{ - using System.Reflection; - using Asp.Versioning; - using Be.Vlaanderen.Basisregisters.Api; - using Microsoft.AspNetCore.Mvc; - using Microsoft.Net.Http.Headers; - - [ApiVersionNeutral] - [Route("")] - public class EmptyController : ApiController - { - [HttpGet] - [ApiExplorerSettings(IgnoreApi = true)] - public IActionResult Get() - => Request.Headers[HeaderNames.Accept].ToString().Contains("text/html") - ? (IActionResult)new RedirectResult("/docs") - : new OkObjectResult($"Welcome to the Basisregisters Vlaanderen Postal Information Legacy Api {Assembly.GetEntryAssembly().GetVersionText()}."); - } -} diff --git a/src/PostalRegistry.Api.Legacy/Infrastructure/Modules/ApiModule.cs b/src/PostalRegistry.Api.Legacy/Infrastructure/Modules/ApiModule.cs deleted file mode 100755 index f4ebeefb..00000000 --- a/src/PostalRegistry.Api.Legacy/Infrastructure/Modules/ApiModule.cs +++ /dev/null @@ -1,41 +0,0 @@ -namespace PostalRegistry.Api.Legacy.Infrastructure.Modules -{ - using Autofac; - using Autofac.Extensions.DependencyInjection; - using Be.Vlaanderen.Basisregisters.Api.Exceptions; - using Microsoft.Extensions.Configuration; - using Microsoft.Extensions.DependencyInjection; - using Microsoft.Extensions.Logging; - using Projections.Legacy; - using Projections.Syndication.Modules; - - public class ApiModule : Module - { - private readonly IConfiguration _configuration; - private readonly IServiceCollection _services; - private readonly ILoggerFactory _loggerFactory; - - public ApiModule( - IConfiguration configuration, - IServiceCollection services, - ILoggerFactory loggerFactory) - { - _configuration = configuration; - _services = services; - _loggerFactory = loggerFactory; - } - - protected override void Load(ContainerBuilder builder) - { - builder - .RegisterModule(new LegacyModule(_configuration, _services, _loggerFactory)) - .RegisterModule(new SyndicationModule(_configuration, _services, _loggerFactory)); - - builder - .RegisterType() - .AsSelf(); - - builder.Populate(_services); - } - } -} diff --git a/src/PostalRegistry.Api.Legacy/Infrastructure/Options/ResponseOptions.cs b/src/PostalRegistry.Api.Legacy/Infrastructure/Options/ResponseOptions.cs deleted file mode 100755 index 146615a2..00000000 --- a/src/PostalRegistry.Api.Legacy/Infrastructure/Options/ResponseOptions.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace PostalRegistry.Api.Legacy.Infrastructure.Options -{ - public class ResponseOptions - { - public string Naamruimte { get; set; } - public string VolgendeUrl { get; set; } - public string DetailUrl { get; set; } - - public string GemeenteNaamruimte { get; set; } - public string GemeenteDetailUrl { get; set; } - } -} diff --git a/src/PostalRegistry.Api.Legacy/Infrastructure/Program.cs b/src/PostalRegistry.Api.Legacy/Infrastructure/Program.cs deleted file mode 100755 index 4bd7b884..00000000 --- a/src/PostalRegistry.Api.Legacy/Infrastructure/Program.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace PostalRegistry.Api.Legacy.Infrastructure -{ - using Be.Vlaanderen.Basisregisters.Api; - using Microsoft.AspNetCore.Hosting; - - public static class Program - { - public static void Main(string[] args) => CreateWebHostBuilder(args).Build().Run(); - - public static IWebHostBuilder CreateWebHostBuilder(string[] args) - => new WebHostBuilder() - .UseDefaultForApi( - new ProgramOptions - { - Hosting = - { - HttpPort = 3002 - }, - Logging = - { - WriteTextToConsole = false, - WriteJsonToConsole = false - }, - Runtime = - { - CommandLineArgs = args - } - }); - } -} diff --git a/src/PostalRegistry.Api.Legacy/Infrastructure/Startup.cs b/src/PostalRegistry.Api.Legacy/Infrastructure/Startup.cs deleted file mode 100755 index e46721a3..00000000 --- a/src/PostalRegistry.Api.Legacy/Infrastructure/Startup.cs +++ /dev/null @@ -1,163 +0,0 @@ -namespace PostalRegistry.Api.Legacy.Infrastructure -{ - using Autofac; - using Autofac.Extensions.DependencyInjection; - using Be.Vlaanderen.Basisregisters.Api; - using Configuration; - using Microsoft.AspNetCore.Builder; - using Microsoft.AspNetCore.Hosting; - using Microsoft.Extensions.Configuration; - using Microsoft.Extensions.DependencyInjection; - using Microsoft.Extensions.Diagnostics.HealthChecks; - using Microsoft.Extensions.Logging; - using Microsoft.Extensions.Hosting; - using Modules; - using Options; - using Projections.Legacy; - using System; - using System.Linq; - using System.Reflection; - using Asp.Versioning.ApiExplorer; - using Microsoft.OpenApi.Models; - - /// Represents the startup process for the application. - public class Startup - { - private const string DatabaseTag = "db"; - - private IContainer _applicationContainer; - - private readonly IConfiguration _configuration; - private readonly ILoggerFactory _loggerFactory; - - public Startup( - IConfiguration configuration, - ILoggerFactory loggerFactory) - { - _configuration = configuration; - _loggerFactory = loggerFactory; - } - - /// Configures services for the application. - /// The collection of services to configure the application with. - public IServiceProvider ConfigureServices(IServiceCollection services) - { - var baseUrl = _configuration.GetValue("BaseUrl"); - var baseUrlForExceptions = baseUrl.EndsWith("/") - ? baseUrl.Substring(0, baseUrl.Length - 1) - : baseUrl; - - services - .ConfigureDefaultForApi(new StartupConfigureOptions - { - Cors = - { - Origins = _configuration - .GetSection("Cors") - .GetChildren() - .Select(c => c.Value) - .ToArray() - }, - Server = - { - BaseUrl = baseUrlForExceptions - }, - Swagger = - { - ApiInfo = (provider, description) => new OpenApiInfo - { - Version = description.ApiVersion.ToString(), - Title = "Basisregisters Vlaanderen Postal Information Registry API", - Description = GetApiLeadingText(description), - Contact = new OpenApiContact - { - Name = "Digitaal Vlaanderen", - Email = "digitaal.vlaanderen@vlaanderen.be", - Url = new Uri("https://legacy.basisregisters.vlaanderen") - } - }, - XmlCommentPaths = new [] { typeof(Startup).GetTypeInfo().Assembly.GetName().Name } - }, - MiddlewareHooks = - { - FluentValidation = fv => fv.RegisterValidatorsFromAssemblyContaining(), - - AfterHealthChecks = health => - { - var connectionStrings = _configuration - .GetSection("ConnectionStrings") - .GetChildren(); - - foreach (var connectionString in connectionStrings) - health.AddSqlServer( - connectionString.Value, - name: $"sqlserver-{connectionString.Key.ToLowerInvariant()}", - tags: new[] { DatabaseTag, "sql", "sqlserver" }); - - health.AddDbContextCheck( - $"dbcontext-{nameof(LegacyContext).ToLowerInvariant()}", - tags: new[] { DatabaseTag, "sql", "sqlserver" }); - } - } - }) - .Configure(_configuration); - - var containerBuilder = new ContainerBuilder(); - containerBuilder.RegisterModule(new ApiModule(_configuration, services, _loggerFactory)); - _applicationContainer = containerBuilder.Build(); - - return new AutofacServiceProvider(_applicationContainer); - } - - public void Configure( - IServiceProvider serviceProvider, - IApplicationBuilder app, - IWebHostEnvironment env, - IHostApplicationLifetime appLifetime, - ILoggerFactory loggerFactory, - IApiVersionDescriptionProvider apiVersionProvider, - HealthCheckService healthCheckService) - { - StartupHelpers.CheckDatabases(healthCheckService, DatabaseTag, loggerFactory).GetAwaiter().GetResult(); - - app - .UseDefaultForApi(new StartupUseOptions - { - Common = - { - ApplicationContainer = _applicationContainer, - ServiceProvider = serviceProvider, - HostingEnvironment = env, - ApplicationLifetime = appLifetime, - LoggerFactory = loggerFactory, - }, - Api = - { - VersionProvider = apiVersionProvider, - Info = groupName => $"Basisregisters.Vlaanderen - Postal Information Registry API {groupName}", - CSharpClientOptions = - { - ClassName = "PostalRegistry", - Namespace = "Be.Vlaanderen.Basisregisters" - }, - TypeScriptClientOptions = - { - ClassName = "PostalRegistry" - } - }, - Server = - { - PoweredByName = "Vlaamse overheid - Basisregisters Vlaanderen", - ServerName = "Digitaal Vlaanderen" - }, - MiddlewareHooks = - { - AfterMiddleware = x => x.UseMiddleware() - } - }); - } - - private static string GetApiLeadingText(ApiVersionDescription description) - => $"Momenteel leest u de documentatie voor versie {description.ApiVersion} van de Basisregisters Vlaanderen Postal Information Registry API{string.Format(description.IsDeprecated ? ", **deze API versie is niet meer ondersteund * *." : ".")}"; - } -} diff --git a/src/PostalRegistry.Api.Legacy/PostalInformation/PostalInformationController.cs b/src/PostalRegistry.Api.Legacy/PostalInformation/PostalInformationController.cs deleted file mode 100755 index 01a8c063..00000000 --- a/src/PostalRegistry.Api.Legacy/PostalInformation/PostalInformationController.cs +++ /dev/null @@ -1,321 +0,0 @@ -namespace PostalRegistry.Api.Legacy.PostalInformation -{ - using System; - using System.Linq; - using System.Net.Mime; - using System.Text; - using System.Threading; - using System.Threading.Tasks; - using System.Xml; - using Asp.Versioning; - using Be.Vlaanderen.Basisregisters.Api; - using Be.Vlaanderen.Basisregisters.Api.Exceptions; - using Be.Vlaanderen.Basisregisters.Api.Search; - using Be.Vlaanderen.Basisregisters.Api.Search.Filtering; - using Be.Vlaanderen.Basisregisters.Api.Search.Pagination; - using Be.Vlaanderen.Basisregisters.Api.Search.Sorting; - using Be.Vlaanderen.Basisregisters.Api.Syndication; - using Be.Vlaanderen.Basisregisters.GrAr.Common; - using Be.Vlaanderen.Basisregisters.GrAr.Common.Syndication; - using Be.Vlaanderen.Basisregisters.GrAr.Legacy; - using Be.Vlaanderen.Basisregisters.GrAr.Legacy.Gemeente; - using Be.Vlaanderen.Basisregisters.GrAr.Legacy.PostInfo; - using Convertors; - using Infrastructure; - using Infrastructure.Options; - using Microsoft.AspNetCore.Http; - using Microsoft.AspNetCore.Mvc; - using Microsoft.EntityFrameworkCore; - using Microsoft.Extensions.Configuration; - using Microsoft.Extensions.Options; - using Microsoft.SyndicationFeed; - using Microsoft.SyndicationFeed.Atom; - using Projections.Legacy; - using Projections.Syndication; - using Query; - using Responses; - using Swashbuckle.AspNetCore.Filters; - using ProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ProblemDetails; - - [ApiVersion("1.0")] - [AdvertiseApiVersions("1.0")] - [ApiRoute("postcodes")] - [ApiExplorerSettings(GroupName = "Postcodes")] - public class PostalInformationController : ApiController - { - /// - /// Vraag info over een postcode op. - /// - /// - /// - /// - /// De postcode. - /// - /// Als de postcode gevonden is. - /// Als de postcode niet gevonden kan worden. - /// Als er een interne fout is opgetreden. - [HttpGet("{postalCode}")] - [ProducesResponseType(typeof(PostalInformationResponse), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)] - [SwaggerResponseExample(StatusCodes.Status200OK, typeof(PostalInformationResponseExamples))] - [SwaggerResponseExample(StatusCodes.Status404NotFound, typeof(PostalInformationNotFoundResponseExamples))] - [SwaggerResponseExample(StatusCodes.Status500InternalServerError, typeof(InternalServerErrorResponseExamples))] - public async Task Get( - [FromServices] LegacyContext context, - [FromServices] SyndicationContext syndicationContext, - [FromServices] IOptions responseOptions, - [FromRoute] string postalCode, - CancellationToken cancellationToken = default) - { - var postalInformation = await context - .PostalInformation - .AsNoTracking() - .Include(item => item.PostalNames) - .SingleOrDefaultAsync(item => item.PostalCode == postalCode, cancellationToken); - - if (postalInformation == null) - { - throw new ApiException("Onbestaande postcode.", StatusCodes.Status404NotFound); - } - - var gemeente = await GetPostinfoDetailGemeente( - syndicationContext, - postalInformation.NisCode, - responseOptions.Value.GemeenteDetailUrl, - cancellationToken); - - return Ok( - new PostalInformationResponse( - responseOptions.Value.Naamruimte, - postalCode, - gemeente, - postalInformation.VersionTimestamp.ToBelgianDateTimeOffset(), - postalInformation.IsRetired - ? PostInfoStatus.Gehistoreerd - : PostInfoStatus.Gerealiseerd) - { - Postnamen = postalInformation - .PostalNames - .Select(name => new Postnaam(new GeografischeNaam(name.Name, name.Language.ConvertFromLanguage()))) - .ToList() - }); - } - - /// - /// Vraag een lijst met actieve postcodes op. - /// - /// - /// - /// - /// - /// Als de opvraging van een lijst met postcodes gelukt is. - /// Als er een interne fout is opgetreden. - [HttpGet] - [ProducesResponseType(typeof(PostalInformationListResponse), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)] - [SwaggerResponseExample(StatusCodes.Status200OK, typeof(PostalInformationListResponseExamples))] - [SwaggerResponseExample(StatusCodes.Status500InternalServerError, typeof(InternalServerErrorResponseExamples))] - public async Task List( - [FromServices] LegacyContext legacyContext, - [FromServices] SyndicationContext syndicationContext, - [FromServices] IOptions reponseOptions, - CancellationToken cancellationToken = default) - { - var filtering = Request.ExtractFilteringRequest(); - var sorting = Request.ExtractSortingRequest(); - var pagination = Request.ExtractPaginationRequest(); - - var pagedPostalInformationSet = - new PostalInformationListQuery(legacyContext, syndicationContext) - .Fetch(filtering, sorting, pagination); - - Response.AddPagedQueryResultHeaders(pagedPostalInformationSet); - - var postalInformationSet = await pagedPostalInformationSet.Items - .Include(x => x.PostalNames) - .ToListAsync(cancellationToken); - - var items = postalInformationSet - .Select(p => new PostalInformationListItemResponse( - p.PostalCode, - reponseOptions.Value.Naamruimte, - reponseOptions.Value.DetailUrl, - p.IsRetired ? PostInfoStatus.Gehistoreerd : PostInfoStatus.Gerealiseerd, - p.VersionTimestamp.ToBelgianDateTimeOffset()) - { - Postnamen = p.PostalNames.Select(x => x.ConvertFromPostalName()).ToList() - }).ToList(); - - return Ok(new PostalInformationListResponse - { - PostInfoObjecten = items, - Volgende = BuildNextUri(pagedPostalInformationSet.PaginationInfo, items.Count, reponseOptions.Value.VolgendeUrl) - }); - } - - /// - /// Vraag het totaal aantal van actieve postcodes op. - /// - /// - /// - /// Als de opvraging van het totaal aantal gelukt is. - /// Als er een interne fout is opgetreden. - [HttpGet("totaal-aantal")] - [ProducesResponseType(typeof(TotaalAantalResponse), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)] - [SwaggerResponseExample(StatusCodes.Status200OK, typeof(TotalCountResponseExample))] - [SwaggerResponseExample(StatusCodes.Status500InternalServerError, typeof(InternalServerErrorResponseExamples))] - public async Task Count( - [FromServices] LegacyContext context, - [FromServices] SyndicationContext syndicationContext, - CancellationToken cancellationToken = default) - { - var filtering = Request.ExtractFilteringRequest(); - var sorting = Request.ExtractSortingRequest(); - var pagination = new NoPaginationRequest(); - - return Ok( - new TotaalAantalResponse - { - Aantal = filtering.ShouldFilter - ? await new PostalInformationListQuery(context, syndicationContext) - .Fetch(filtering, sorting, pagination) - .Items - .CountAsync(cancellationToken) - : await context - .PostalInformation - .CountAsync(cancellationToken) - }); - } - - /// - /// Vraag een lijst met wijzigingen van postinfo op. - /// - /// - /// - /// - /// - /// - [HttpGet("sync")] - [Produces("text/xml")] - [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] - [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)] - [SwaggerResponseExample(StatusCodes.Status200OK, typeof(PostalInformationSyndicationResponseExamples))] - [SwaggerResponseExample(StatusCodes.Status400BadRequest, typeof(BadRequestResponseExamples))] - [SwaggerResponseExample(StatusCodes.Status500InternalServerError, typeof(InternalServerErrorResponseExamples))] - public async Task Sync( - [FromServices] IConfiguration configuration, - [FromServices] LegacyContext context, - [FromServices] IOptions responseOptions, - CancellationToken cancellationToken = default) - { - var filtering = Request.ExtractFilteringRequest(); - var sorting = Request.ExtractSortingRequest(); - var pagination = Request.ExtractPaginationRequest(); - - var lastFeedUpdate = await context - .PostalInformationSyndication - .AsNoTracking() - .OrderByDescending(item => item.Position) - .Select(item => item.SyndicationItemCreatedAt) - .FirstOrDefaultAsync(cancellationToken); - - if (lastFeedUpdate == default) - lastFeedUpdate = new DateTimeOffset(2020, 1, 1, 0, 0, 0, TimeSpan.Zero); - - var pagedPostalInformationSet = - new PostalInformationSyndicationQuery( - context, - filtering.Filter?.Embed) - .Fetch(filtering, sorting, pagination); - - return new ContentResult - { - Content = await BuildAtomFeed(lastFeedUpdate, pagedPostalInformationSet, responseOptions, configuration), - ContentType = MediaTypeNames.Text.Xml, - StatusCode = StatusCodes.Status200OK - }; - } - - private static async Task BuildAtomFeed( - DateTimeOffset lastFeedUpdate, - PagedQueryable pagedPostalInfoItems, - IOptions responseOptions, - IConfiguration configuration) - { - var sw = new StringWriterWithEncoding(Encoding.UTF8); - - using (var xmlWriter = XmlWriter.Create(sw, new XmlWriterSettings { Async = true, Indent = true, Encoding = sw.Encoding })) - { - var formatter = new AtomFormatter(null, xmlWriter.Settings) { UseCDATA = true }; - var writer = new AtomFeedWriter(xmlWriter, null, formatter); - var syndicationConfiguration = configuration.GetSection("Syndication"); - var atomFeedConfig = AtomFeedConfigurationBuilder.CreateFrom(syndicationConfiguration, lastFeedUpdate); - - await writer.WriteDefaultMetadata(atomFeedConfig); - - var postalInfos = pagedPostalInfoItems.Items.ToList(); - - var nextFrom = postalInfos.Any() - ? postalInfos.Max(x => x.Position) + 1 - : (long?) null; - - var nextUri = BuildNextSyncUri(pagedPostalInfoItems.PaginationInfo.Limit, nextFrom, syndicationConfiguration["NextUri"]); - if (nextUri != null) - await writer.Write(new SyndicationLink(nextUri, GrArAtomLinkTypes.Next)); - - foreach (var postalInfo in postalInfos) - await writer.WritePostalInfo(responseOptions, formatter, syndicationConfiguration["Category"], postalInfo); - - xmlWriter.Flush(); - } - - return sw.ToString(); - } - - private static Uri? BuildNextUri(PaginationInfo paginationInfo, int itemsInCollection, string nextUrlBase) - { - var offset = paginationInfo.Offset; - var limit = paginationInfo.Limit; - - return paginationInfo.HasNextPage(itemsInCollection) - ? new Uri(string.Format(nextUrlBase, offset + limit, limit)) - : null; - } - - private static Uri? BuildNextSyncUri(int limit, long? from, string nextUrlBase) - { - return from.HasValue - ? new Uri(string.Format(nextUrlBase, from.Value, limit)) - : null; - } - - private async Task GetPostinfoDetailGemeente( - SyndicationContext syndicationContext, - string? nisCode, - string gemeenteDetailUrl, - CancellationToken ct) - { - var municipality = await syndicationContext - .MunicipalityLatestItems - .AsNoTracking() - .FirstOrDefaultAsync(m => m.NisCode == nisCode, ct); - - if (municipality is null) - { - return null; - } - - var municipalityDefaultName = municipality.DefaultName; - var gemeente = new PostinfoDetailGemeente - { - ObjectId = nisCode, - Detail = string.Format(gemeenteDetailUrl, nisCode), - Gemeentenaam = new Gemeentenaam(new GeografischeNaam(municipalityDefaultName.Value, municipalityDefaultName.Key)) - }; - return gemeente; - } - } -} diff --git a/src/PostalRegistry.Api.Legacy/PostalInformation/Query/PostalInformationListQuery.cs b/src/PostalRegistry.Api.Legacy/PostalInformation/Query/PostalInformationListQuery.cs deleted file mode 100755 index aa94bc91..00000000 --- a/src/PostalRegistry.Api.Legacy/PostalInformation/Query/PostalInformationListQuery.cs +++ /dev/null @@ -1,73 +0,0 @@ -namespace PostalRegistry.Api.Legacy.PostalInformation.Query -{ - using System.Collections.Generic; - using System.Linq; - using Be.Vlaanderen.Basisregisters.Api.Search; - using Be.Vlaanderen.Basisregisters.Api.Search.Filtering; - using Be.Vlaanderen.Basisregisters.Api.Search.Sorting; - using Be.Vlaanderen.Basisregisters.GrAr.Common; - using Microsoft.EntityFrameworkCore; - using Projections.Legacy; - using Projections.Legacy.PostalInformation; - using Projections.Syndication; - - public class PostalInformationListQuery : Query - { - private readonly LegacyContext _context; - private readonly SyndicationContext _syndicationContext; - - protected override ISorting Sorting => new PostalInformationSorting(); - - public PostalInformationListQuery(LegacyContext context, SyndicationContext syndicationContext) - { - _context = context; - _syndicationContext = syndicationContext; - } - - protected override IQueryable Filter(FilteringHeader filtering) - { - var postalInformationSet = _context - .PostalInformation - .AsNoTracking() - .OrderBy(x => x.PostalCode) - .Where(p => !p.IsRetired); - - if (!filtering.ShouldFilter) - return postalInformationSet; - - var filterMunicipalityName = filtering.Filter.MunicipalityName.RemoveDiacritics(); - if (!string.IsNullOrEmpty(filterMunicipalityName)) - { - var municipalityNisCodes = _syndicationContext - .MunicipalityLatestItems - .AsNoTracking() - .Where(x => x.NameDutchSearch == filterMunicipalityName || - x.NameFrenchSearch == filterMunicipalityName || - x.NameEnglishSearch == filterMunicipalityName || - x.NameGermanSearch == filterMunicipalityName) - .Select(x => x.NisCode) - .ToList(); - - postalInformationSet = postalInformationSet.Where(x => municipalityNisCodes.Contains(x.NisCode)); - } - - return postalInformationSet; - } - } - - internal class PostalInformationSorting : ISorting - { - public IEnumerable SortableFields { get; } = new[] - { - nameof(PostalInformation.PostalCode) - }; - - public SortingHeader DefaultSortingHeader { get; } = - new SortingHeader(nameof(PostalInformation.PostalCode), SortOrder.Ascending); - } - - public class PostalInformationFilter - { - public string MunicipalityName { get; set; } - } -} diff --git a/src/PostalRegistry.Api.Legacy/PostalInformation/Query/PostalInformationSyndicationQuery.cs b/src/PostalRegistry.Api.Legacy/PostalInformation/Query/PostalInformationSyndicationQuery.cs deleted file mode 100755 index 9e3681ff..00000000 --- a/src/PostalRegistry.Api.Legacy/PostalInformation/Query/PostalInformationSyndicationQuery.cs +++ /dev/null @@ -1,240 +0,0 @@ -namespace PostalRegistry.Api.Legacy.PostalInformation.Query -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Linq.Expressions; - using Be.Vlaanderen.Basisregisters.Api.Search; - using Be.Vlaanderen.Basisregisters.Api.Search.Filtering; - using Be.Vlaanderen.Basisregisters.Api.Search.Sorting; - using Be.Vlaanderen.Basisregisters.GrAr.Provenance; - using Microsoft.EntityFrameworkCore; - using NodaTime; - using Projections.Legacy; - using Projections.Legacy.PostalInformationSyndication; - - public class PostalInformationSyndicationQueryResult - { - public bool ContainsEvent { get; } - public bool ContainsObject { get; } - - public string PostalCode { get; } - public long Position { get; } - public string ChangeType { get; } - - public Instant RecordCreatedAt { get; } - public Instant LastChangedOn { get; } - public PostalInformationStatus? Status { get; } - public IEnumerable PostalNames { get; } - public string MunicipalityNisCode { get; } - public Organisation? Organisation { get; } - public string Reason { get; } - public string EventDataAsXml { get; } - - public PostalInformationSyndicationQueryResult( - string postalCode, - long position, - string changeType, - Instant recordCreatedAt, - Instant lastChangedOn, - string municipalityNisCode, - Organisation? organisation, - string reason) - { - ContainsEvent = false; - ContainsObject = false; - - PostalCode = postalCode; - Position = position; - ChangeType = changeType; - RecordCreatedAt = recordCreatedAt; - LastChangedOn = lastChangedOn; - MunicipalityNisCode = municipalityNisCode; - Organisation = organisation; - Reason = reason; - } - - public PostalInformationSyndicationQueryResult( - string postalCode, - long position, - string changeType, - Instant recordCreatedAt, - Instant lastChangedOn, - string municipalityNisCode, - Organisation? organisation, - string reason, - string eventDataAsXml) - : this(postalCode, - position, - changeType, - recordCreatedAt, - lastChangedOn, - municipalityNisCode, - organisation, - reason) - { - ContainsEvent = true; - - EventDataAsXml = eventDataAsXml; - } - - public PostalInformationSyndicationQueryResult( - string postalCode, - long position, - string changeType, - Instant recordCreatedAt, - Instant lastChangedOn, - PostalInformationStatus? status, - IEnumerable postalNames, - string municipalityNisCode, - Organisation? organisation, - string reason) : - this( - postalCode, - position, - changeType, - recordCreatedAt, - lastChangedOn, - municipalityNisCode, - organisation, - reason) - { - ContainsObject = true; - - Status = status; - PostalNames = postalNames; - } - - public PostalInformationSyndicationQueryResult( - string postalCode, - long position, - string changeType, - Instant recordCreatedAt, - Instant lastChangedOn, - PostalInformationStatus? status, - IEnumerable postalNames, - string municipalityNisCode, - Organisation? organisation, - string reason, - string eventDataAsXml) - : this( - postalCode, - position, - changeType, - recordCreatedAt, - lastChangedOn, - status, - postalNames, - municipalityNisCode, - organisation, - reason) - { - ContainsEvent = true; - EventDataAsXml = eventDataAsXml; - } - } - - public class PostalInformationSyndicationQuery : Query - { - private readonly LegacyContext _context; - private readonly bool _embedEvent; - private readonly bool _embedObject; - - public PostalInformationSyndicationQuery(LegacyContext context, SyncEmbedValue embed) - { - _context = context; - _embedEvent = embed?.Event ?? false; - _embedObject = embed?.Object ?? false; - } - - protected override ISorting Sorting => new PostalInformationSyndicationSorting(); - - protected override Expression> Transformation - { - get - { - if (_embedEvent && _embedObject) - return syndicationItem => new PostalInformationSyndicationQueryResult( - syndicationItem.PostalCode, - syndicationItem.Position, - syndicationItem.ChangeType, - syndicationItem.RecordCreatedAt, - syndicationItem.LastChangedOn, - syndicationItem.Status, - syndicationItem.PostalNames, - syndicationItem.MunicipalityNisCode, - syndicationItem.Organisation, - syndicationItem.Reason, - syndicationItem.EventDataAsXml); - - if (_embedEvent) - return syndicationItem => new PostalInformationSyndicationQueryResult( - syndicationItem.PostalCode, - syndicationItem.Position, - syndicationItem.ChangeType, - syndicationItem.RecordCreatedAt, - syndicationItem.LastChangedOn, - syndicationItem.MunicipalityNisCode, - syndicationItem.Organisation, - syndicationItem.Reason, - syndicationItem.EventDataAsXml); - - if(_embedObject) - return syndicationItem => new PostalInformationSyndicationQueryResult( - syndicationItem.PostalCode, - syndicationItem.Position, - syndicationItem.ChangeType, - syndicationItem.RecordCreatedAt, - syndicationItem.LastChangedOn, - syndicationItem.Status, - syndicationItem.PostalNames, - syndicationItem.MunicipalityNisCode, - syndicationItem.Organisation, - syndicationItem.Reason); - - return syndicationItem => new PostalInformationSyndicationQueryResult( - syndicationItem.PostalCode, - syndicationItem.Position, - syndicationItem.ChangeType, - syndicationItem.RecordCreatedAt, - syndicationItem.LastChangedOn, - syndicationItem.MunicipalityNisCode, - syndicationItem.Organisation, - syndicationItem.Reason); - } - } - - protected override IQueryable Filter(FilteringHeader filtering) - { - var postalInformationSet = _context - .PostalInformationSyndication - .OrderBy(x => x.Position) - .AsNoTracking(); - - if (!filtering.ShouldFilter) - return postalInformationSet; - - if (filtering.Filter.Position.HasValue) - postalInformationSet = postalInformationSet.Where(item => item.Position >= filtering.Filter.Position); - - return postalInformationSet; - } - } - - internal class PostalInformationSyndicationSorting : ISorting - { - public IEnumerable SortableFields { get; } = new[] - { - nameof(PostalInformationSyndicationItem.Position) - }; - - public SortingHeader DefaultSortingHeader { get; } = new SortingHeader(nameof(PostalInformationSyndicationItem.Position), SortOrder.Ascending); - } - - public class PostalInformationSyndicationFilter - { - public long? Position { get; set; } - public SyncEmbedValue Embed { get; set; } - } -} diff --git a/src/PostalRegistry.Api.Legacy/PostalInformation/Responses/PostalInformationListResponse.cs b/src/PostalRegistry.Api.Legacy/PostalInformation/Responses/PostalInformationListResponse.cs deleted file mode 100755 index 8954fa3a..00000000 --- a/src/PostalRegistry.Api.Legacy/PostalInformation/Responses/PostalInformationListResponse.cs +++ /dev/null @@ -1,120 +0,0 @@ -namespace PostalRegistry.Api.Legacy.PostalInformation.Responses -{ - using System; - using System.Collections.Generic; - using System.Runtime.Serialization; - using Be.Vlaanderen.Basisregisters.GrAr.Common; - using Be.Vlaanderen.Basisregisters.GrAr.Legacy; - using Be.Vlaanderen.Basisregisters.GrAr.Legacy.PostInfo; - using Infrastructure.Options; - using Microsoft.Extensions.Options; - using Newtonsoft.Json; - using Swashbuckle.AspNetCore.Filters; - - [DataContract(Name = "PostinfoCollectie", Namespace = "")] - public class PostalInformationListResponse - { - /// - /// De verzameling van postcodes. - /// - [DataMember(Name = "PostInfoObjecten", Order = 1)] - [JsonProperty(Required = Required.DisallowNull)] - public List PostInfoObjecten { get; set; } - - /// - /// Het totaal aantal gemeenten die overeenkomen met de vraag. - /// - //[DataMember(Name = "TotaalAantal", Order = 2)] - //[JsonProperty(Required = Required.DisallowNull)] - //public long TotaalAantal { get; set; } - - /// - /// De URL voor het ophalen van de volgende verzameling. - /// - [DataMember(Name = "Volgende", Order = 3, EmitDefaultValue = false)] - [JsonProperty(Required = Required.Default, DefaultValueHandling = DefaultValueHandling.Ignore)] - public Uri Volgende { get; set; } - } - - [DataContract(Name = "PostInfo", Namespace = "")] - public class PostalInformationListItemResponse - { - /// - /// De identificator van de postcode. - /// - [DataMember(Name = "Identificator", Order = 1)] - [JsonProperty(Required = Required.DisallowNull)] - public PostinfoIdentificator Identificator { get; set; } - - /// - /// De URL die de details van de meest recente versie van de postinfo weergeeft. - /// - [DataMember(Name = "Detail", Order = 2)] - [JsonProperty(Required = Required.DisallowNull)] - public Uri Detail { get; set; } - - /// - /// De huidige fase in de doorlooptijd van de postcode. - /// - [DataMember(Name = "PostInfoStatus", Order = 3)] - [JsonProperty(Required = Required.DisallowNull)] - public PostInfoStatus PostInfoStatus { get; set; } - - /// - /// De namen van het gebied dat de postcode beslaat, in de taal afkomstig uit het bPost bestand. - /// - [DataMember(Name = "Postnamen", Order = 3)] - [JsonProperty(Required = Required.DisallowNull)] - public List Postnamen { get; set; } - - public PostalInformationListItemResponse( - string postalCode, - string naamruimte, - string detail, - PostInfoStatus status, - DateTimeOffset? version) - { - Identificator = new PostinfoIdentificator(naamruimte, postalCode, version); - Detail = new Uri(string.Format(detail, postalCode)); - PostInfoStatus = status; - } - } - - public class PostalInformationListResponseExamples : IExamplesProvider - { - private readonly ResponseOptions _responseOptions; - - public PostalInformationListResponseExamples(IOptions responseOptionsProvider) => _responseOptions = responseOptionsProvider.Value; - - public PostalInformationListResponse GetExamples() - { - var postalInformationSampleGent = - new PostalInformationListItemResponse("9000", _responseOptions.Naamruimte, _responseOptions.DetailUrl, PostInfoStatus.Gerealiseerd, DateTimeOffset.Now.ToExampleOffset()) - { - Postnamen = new List - { - new Postnaam(new GeografischeNaam("Gent", Taal.NL)) - } - }; - - var postalInformationSampleTemse = - new PostalInformationListItemResponse("9140", _responseOptions.Naamruimte, _responseOptions.DetailUrl, PostInfoStatus.Gerealiseerd, DateTimeOffset.Now.ToExampleOffset()) - { - Postnamen = new List - { - new Postnaam(new GeografischeNaam("Temse", Taal.NL)) - } - }; - - return new PostalInformationListResponse - { - PostInfoObjecten = new List - { - postalInformationSampleGent, - postalInformationSampleTemse - }, - Volgende = new Uri(string.Format(_responseOptions.VolgendeUrl, 2, 10)) - }; - } - } -} diff --git a/src/PostalRegistry.Api.Legacy/PostalInformation/Responses/PostalInformationResponse.cs b/src/PostalRegistry.Api.Legacy/PostalInformation/Responses/PostalInformationResponse.cs deleted file mode 100755 index 283d19cf..00000000 --- a/src/PostalRegistry.Api.Legacy/PostalInformation/Responses/PostalInformationResponse.cs +++ /dev/null @@ -1,118 +0,0 @@ -namespace PostalRegistry.Api.Legacy.PostalInformation.Responses -{ - using System; - using System.Collections.Generic; - using System.Runtime.Serialization; - using Be.Vlaanderen.Basisregisters.Api.Exceptions; - using Be.Vlaanderen.Basisregisters.GrAr.Common; - using Be.Vlaanderen.Basisregisters.GrAr.Legacy; - using Be.Vlaanderen.Basisregisters.GrAr.Legacy.Gemeente; - using Be.Vlaanderen.Basisregisters.GrAr.Legacy.PostInfo; - using Infrastructure.Options; - using Microsoft.AspNetCore.Http; - using Microsoft.Extensions.Options; - using Newtonsoft.Json; - using Swashbuckle.AspNetCore.Filters; - using ProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ProblemDetails; - - [DataContract(Name = "PostinfoDetail", Namespace = "")] - public class PostalInformationResponse - { - /// - /// De identificator van de postcode. - /// - [DataMember(Name = "Identificator", Order = 1)] - [JsonProperty(Required = Required.DisallowNull)] - public PostinfoIdentificator Identificator { get; set; } - - /// - /// De gemeente aan dewelke de postinfo is toegewezen. - /// - [DataMember(Name = "Gemeente", Order = 2, EmitDefaultValue = false)] - [JsonProperty(Required = Required.Default, DefaultValueHandling = DefaultValueHandling.Ignore)] - public PostinfoDetailGemeente? Gemeente { get; set; } - - /// - /// De namen van het gebied dat de postcode beslaat, in de taal afkomstig uit het bPost bestand. - /// - [DataMember(Name = "Postnamen", Order = 3)] - [JsonProperty(Required = Required.DisallowNull)] - public List Postnamen { get; set; } - - /// - /// De huidige fase in de doorlooptijd van de postcode. - /// - [DataMember(Name = "PostInfoStatus", Order = 4)] - [JsonProperty(Required = Required.DisallowNull)] - public PostInfoStatus PostInfoStatus { get; set; } - - public PostalInformationResponse( - string naamruimte, - string postcode, - PostinfoDetailGemeente? gemeente, - DateTimeOffset version, - PostInfoStatus postInfoStatus) - { - Identificator = new PostinfoIdentificator(naamruimte, postcode, version); - PostInfoStatus = postInfoStatus; - Gemeente = gemeente; - - Postnamen = new List(); - } - } - - public class PostalInformationResponseExamples : IExamplesProvider - { - private readonly ResponseOptions _responseOptions; - - public PostalInformationResponseExamples(IOptions responseOptionsProvider) => _responseOptions = responseOptionsProvider.Value; - - public PostalInformationResponse GetExamples() - { - var gemeente = new PostinfoDetailGemeente - { - ObjectId = "31005", - Detail = string.Format(_responseOptions.GemeenteDetailUrl, "31005"), - Gemeentenaam = new Gemeentenaam(new GeografischeNaam("Brugge", Taal.NL)) - }; - - return new PostalInformationResponse( - _responseOptions.Naamruimte, - "8200", - gemeente, - DateTimeOffset.Now.ToExampleOffset(), - PostInfoStatus.Gerealiseerd) - { - Postnamen = new List - { - new Postnaam(new GeografischeNaam("Sint-Andries", Taal.NL)), - new Postnaam(new GeografischeNaam("Sint-Michiels", Taal.NL)) - } - }; - } - } - - public class PostalInformationNotFoundResponseExamples : IExamplesProvider - { - private readonly IHttpContextAccessor _httpContextAccessor; - private readonly ProblemDetailsHelper _problemDetailsHelper; - - public PostalInformationNotFoundResponseExamples( - IHttpContextAccessor httpContextAccessor, - ProblemDetailsHelper problemDetailsHelper) - { - _httpContextAccessor = httpContextAccessor; - _problemDetailsHelper = problemDetailsHelper; - } - - public ProblemDetails GetExamples() - => new ProblemDetails - { - ProblemTypeUri = "urn:be.vlaanderen.basisregisters.api:postalcode:not-found", - HttpStatus = StatusCodes.Status404NotFound, - Title = ProblemDetails.DefaultTitle, - Detail = "Onbestaande postcode.", - ProblemInstanceUri = _problemDetailsHelper.GetInstanceUri(_httpContextAccessor.HttpContext, "v1") - }; - } -} diff --git a/src/PostalRegistry.Api.Legacy/PostalInformation/Responses/PostalInformationSyndicationResponse.cs b/src/PostalRegistry.Api.Legacy/PostalInformation/Responses/PostalInformationSyndicationResponse.cs deleted file mode 100755 index 83548326..00000000 --- a/src/PostalRegistry.Api.Legacy/PostalInformation/Responses/PostalInformationSyndicationResponse.cs +++ /dev/null @@ -1,240 +0,0 @@ -namespace PostalRegistry.Api.Legacy.PostalInformation.Responses -{ - using System; - using System.Collections.Generic; - using System.Globalization; - using System.Linq; - using System.Runtime.Serialization; - using System.Threading.Tasks; - using System.Xml; - using Be.Vlaanderen.Basisregisters.GrAr.Common; - using Be.Vlaanderen.Basisregisters.GrAr.Common.Syndication; - using Be.Vlaanderen.Basisregisters.GrAr.Legacy; - using Be.Vlaanderen.Basisregisters.GrAr.Legacy.PostInfo; - using Be.Vlaanderen.Basisregisters.GrAr.Provenance; - using Convertors; - using Infrastructure.Options; - using Microsoft.Extensions.Options; - using Microsoft.SyndicationFeed; - using Microsoft.SyndicationFeed.Atom; - using Query; - using Swashbuckle.AspNetCore.Filters; - using Provenance = Be.Vlaanderen.Basisregisters.GrAr.Provenance.Syndication.Provenance; - - public static class PostalInformationSyndicationResponse - { - public static async Task WritePostalInfo( - this ISyndicationFeedWriter writer, - IOptions responseOptions, - AtomFormatter formatter, - string category, - PostalInformationSyndicationQueryResult postalInformation) - { - var item = new SyndicationItem - { - Id = postalInformation.Position.ToString(CultureInfo.InvariantCulture), - Title = $"{postalInformation.ChangeType}-{postalInformation.Position}", - Published = postalInformation.RecordCreatedAt.ToBelgianDateTimeOffset(), - LastUpdated = postalInformation.LastChangedOn.ToBelgianDateTimeOffset(), - Description = BuildDescription(postalInformation, responseOptions.Value.Naamruimte) - }; - - if (!string.IsNullOrWhiteSpace(postalInformation.PostalCode)) - { - item.AddLink( - new SyndicationLink( - new Uri($"{responseOptions.Value.Naamruimte}/{postalInformation.PostalCode}"), - AtomLinkTypes.Related)); - - //item.AddLink( - // new SyndicationLink( - // new Uri(string.Format(responseOptions.Value.DetailUrl, postalInformation.PostalCode)), - // AtomLinkTypes.Self)); - - //item.AddLink( - // new SyndicationLink( - // new Uri(string.Format($"{responseOptions.Value.DetailUrl}.xml", postalInformation.PostalCode)), - // AtomLinkTypes.Alternate) - // { MediaType = MediaTypeNames.Application.Xml }); - - //item.AddLink( - // new SyndicationLink( - // new Uri(string.Format($"{responseOptions.Value.DetailUrl}.json", postalInformation.PostalCode)), - // AtomLinkTypes.Alternate) - // { MediaType = MediaTypeNames.Application.Json }); - } - - item.AddCategory( - new SyndicationCategory(category)); - - item.AddContributor( - new SyndicationPerson( - postalInformation.Organisation == null ? Organisation.Unknown.ToName() : postalInformation.Organisation.Value.ToName(), - string.Empty, - AtomContributorTypes.Author)); - - await writer.Write(item); - } - - private static string BuildDescription(PostalInformationSyndicationQueryResult postalInformation, string naamruimte) - { - if (!postalInformation.ContainsEvent && !postalInformation.ContainsObject) - return "No data embedded"; - - var content = new SyndicationContent(); - if (postalInformation.ContainsObject) - content.Object = new PostalInfoSyndicationContent( - naamruimte, - postalInformation.PostalCode, - postalInformation.LastChangedOn.ToBelgianDateTimeOffset(), - postalInformation.Status, - postalInformation.PostalNames, - postalInformation.MunicipalityNisCode, - postalInformation.Organisation, - postalInformation.Reason); - - if (postalInformation.ContainsEvent) - { - var doc = new XmlDocument(); - doc.LoadXml(postalInformation.EventDataAsXml); - content.Event = doc.DocumentElement; - } - - return content.ToXml(); - } - } - - [DataContract(Name = "Content", Namespace = "")] - public class SyndicationContent : SyndicationContentBase - { - [DataMember(Name = "Event")] - public XmlElement Event { get; set; } - - [DataMember(Name = "Object")] - public PostalInfoSyndicationContent Object { get; set; } - } - - [DataContract(Name = "PostInfo", Namespace = "")] - public class PostalInfoSyndicationContent - { - /// - /// De technische id van de postinfo. - /// - [DataMember(Name = "Id", Order = 1)] - public string PostalCode { get; set; } - - /// - /// De identificator van de postcode. - /// - [DataMember(Name = "Identificator", Order = 1)] - public PostinfoIdentificator Identificator { get; set; } - - /// - /// De namen van het gebied dat de postcode beslaat, in de taal afkomstig uit het bPost bestand. - /// - [DataMember(Name = "Postnamen", Order = 2)] - public List PostalNames { get; set; } - - /// - /// De huidige fase in de doorlooptijd van de postcode. - /// - [DataMember(Name = "PostInfoStatus", Order = 3)] - public PostInfoStatus? Status { get; set; } - - /// - /// De NisCode van de gemeente waarmee de postcode verwant is. - /// - [DataMember(Name = "NisCode", Order = 3)] - public string MunicipalityNisCode { get; set; } - - /// - /// Creatie data ivm het item. - /// - [DataMember(Name = "Creatie", Order = 4)] - public Provenance Provenance { get; set; } - - public PostalInfoSyndicationContent( - string naamruimte, - string postcode, - DateTimeOffset version, - PostalInformationStatus? status, - IEnumerable postalNames, - string municipalityNisCode, - Organisation? organisation, - string reason) - { - PostalCode = postcode; - Identificator = new PostinfoIdentificator(naamruimte, postcode, version); - Status = status?.ConvertFromPostalInformationStatus(); - MunicipalityNisCode = municipalityNisCode; - PostalNames = postalNames? - .Select(name => new Postnaam(new GeografischeNaam(name.Name, name.Language.ConvertFromLanguage()))) - .ToList() - ?? new List(); - Provenance = new Provenance(version, organisation, new Reason(reason)); - } - } - - public class PostalInformationSyndicationResponseExamples : IExamplesProvider - { - const string RawXml = @" - - https://api.basisregisters.vlaanderen.be/v1/feeds/postinfo.atom - Basisregisters Vlaanderen - feed 'postinfo' - Deze Atom feed geeft leestoegang tot events op de resource 'postinfo'. - Basisregisters Vlaanderen - Gratis hergebruik volgens https://overheid.vlaanderen.be/sites/default/files/documenten/ict-egov/licenties/hergebruik/modellicentie_gratis_hergebruik_v1_0.html - 2020-09-17T09:14:41Z - - Digitaal Vlaanderen - digitaal.vlaanderen@vlaanderen.be - - - - - - - - 0 - PostalInformationWasRegistered-0 - 2019-11-21T09:34:51+01:00 - 2019-11-21T09:34:51+01:00 - - - bpost - - - - 89002019-11-21T08:34:51ZDePostCentrale bijhouding o.b.v. bPost-bestand - - 8900https://data.vlaanderen.be/id/postinfo/8900https://data.vlaanderen.be/id/postinfo89002019-11-21T09:34:51+01:002019-11-21T09:34:51+01:00bpostCentrale bijhouding o.b.v. bPost-bestand - ]]> - - - - 1 - PostalInformationBecameCurrent-1 - 2019-11-21T09:34:51+01:00 - 2019-11-21T09:34:51+01:00 - - - bpost - - - - 89002019-11-21T08:34:51ZDePostCentrale bijhouding o.b.v. bPost-bestand - - 8900https://data.vlaanderen.be/id/postinfo/8900https://data.vlaanderen.be/id/postinfo89002019-11-21T09:34:51+01:00Gerealiseerd2019-11-21T09:34:51+01:00bpostCentrale bijhouding o.b.v. bPost-bestand - ]]> - - -"; - - public XmlElement GetExamples() - { - var example = new XmlDocument(); - example.LoadXml(RawXml); - return example.DocumentElement; - } - } -} diff --git a/src/PostalRegistry.Api.Legacy/PostalInformation/Responses/TotalCountResponseExample.cs b/src/PostalRegistry.Api.Legacy/PostalInformation/Responses/TotalCountResponseExample.cs deleted file mode 100644 index 11cd7fc8..00000000 --- a/src/PostalRegistry.Api.Legacy/PostalInformation/Responses/TotalCountResponseExample.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace PostalRegistry.Api.Legacy.PostalInformation.Responses -{ - using Be.Vlaanderen.Basisregisters.GrAr.Legacy; - using Swashbuckle.AspNetCore.Filters; - - public class TotalCountResponseExample : IExamplesProvider - { - public TotaalAantalResponse GetExamples() - { - return new TotaalAantalResponse - { - Aantal = 574512 - }; - } - } -} diff --git a/src/PostalRegistry.Api.Legacy/PostalRegistry.Api.Legacy.csproj b/src/PostalRegistry.Api.Legacy/PostalRegistry.Api.Legacy.csproj deleted file mode 100755 index 077f7b6a..00000000 --- a/src/PostalRegistry.Api.Legacy/PostalRegistry.Api.Legacy.csproj +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - false - true - false - - - - bin\Debug\net8.0\PostalRegistry.Api.Legacy.xml - 1701;1702;1705;1591 - TRACE;DEBUG;NETCOREAPP;NET8_0 - - - bin\Release\net8.0\PostalRegistry.Api.Legacy.xml - 1701;1702;1705;1591 - - - - false - - - - - - - - - - - - - - - - - - - diff --git a/src/PostalRegistry.Api.Legacy/PostalRegistry.Api.Legacy.csproj.DotSettings b/src/PostalRegistry.Api.Legacy/PostalRegistry.Api.Legacy.csproj.DotSettings deleted file mode 100755 index 195c4606..00000000 --- a/src/PostalRegistry.Api.Legacy/PostalRegistry.Api.Legacy.csproj.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - Latest \ No newline at end of file diff --git a/src/PostalRegistry.Api.Legacy/Properties/AssemblyInfo.cs b/src/PostalRegistry.Api.Legacy/Properties/AssemblyInfo.cs deleted file mode 100755 index bcc91d46..00000000 --- a/src/PostalRegistry.Api.Legacy/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyProduct("Basisregisters Vlaanderen")] -[assembly: AssemblyCopyright("Copyright (c) Vlaamse overheid")] -[assembly: AssemblyCompany("Vlaamse overheid")] -[assembly: AssemblyDescription("PostalRegistry Legacy API")] - -[assembly: ComVisible(false)] -[assembly: Guid("09d90242-3027-45d0-bb10-ac1fb355b810")] diff --git a/src/PostalRegistry.Api.Legacy/Properties/launchSettings.json b/src/PostalRegistry.Api.Legacy/Properties/launchSettings.json deleted file mode 100755 index 3df5747b..00000000 --- a/src/PostalRegistry.Api.Legacy/Properties/launchSettings.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:13215/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "PostalRegistry.Api.Legacy": { - "commandName": "Project", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:5000/" - } - } -} diff --git a/src/PostalRegistry.Api.Legacy/appsettings.json b/src/PostalRegistry.Api.Legacy/appsettings.json deleted file mode 100755 index bf0f69c0..00000000 --- a/src/PostalRegistry.Api.Legacy/appsettings.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "ConnectionStrings": { - "Events": "Server=(localdb)\\mssqllocaldb;Database=EFProviders.InMemory.PostalRegistry;Trusted_Connection=True;TrustServerCertificate=True;", - "LegacyProjections": "Server=(localdb)\\mssqllocaldb;Database=EFProviders.InMemory.PostalRegistry;Trusted_Connection=True;TrustServerCertificate=True;", - "LegacyProjectionsAdmin": "Server=(localdb)\\mssqllocaldb;Database=EFProviders.InMemory.PostalRegistry;Trusted_Connection=True;TrustServerCertificate=True;", - "SyndicationProjections": "Server=(localdb)\\mssqllocaldb;Database=postalregistry-dev;Trusted_Connection=True;TrustServerCertificate=True;", - "SyndicationProjectionsAdmin": "Server=(localdb)\\mssqllocaldb;Database=postalregistry-dev;Trusted_Connection=True;TrustServerCertificate=True;" - }, - - "BaseUrl": "https://api.staging-basisregisters.vlaanderen/", - - "Syndication": { - "Category": "https://data.vlaanderen.be/ns/postinfo", - "Id": "https://legacy.staging-basisregisters.vlaanderen/v1/feeds/postinfo.atom", - "Title": "Basisregisters Vlaanderen - PostInfo register", - "Subtitle": "Deze Atom feed geeft leestoegang tot events op de resource 'postinfo'.", - "GeneratorTitle": "Basisregisters Vlaanderen", - "GeneratorUri": "", - "Rights": "Gratis hergebruik volgens https://overheid.vlaanderen.be/sites/default/files/documenten/ict-egov/licenties/hergebruik/modellicentie_gratis_hergebruik_v1_0.html", - "AuthorName": "Digitaal Vlaanderen", - "AuthorEmail": "digitaal.vlaanderen@vlaanderen.be", - "Self": "https://legacy.staging-basisregisters.vlaanderen/syndication/feed/postalinfo", - "NextUri": "https://legacy.staging-basisregisters.vlaanderen/v1/feeds/postinfo.atom?from={0}&limit={1}", - "Related": [ - "https://legacy.staging-basisregisters.vlaanderen" - ] - }, - - "Cors": [ - "http://localhost:3000", - "http://localhost:5000" - ], - - "Naamruimte": "https://data.vlaanderen.be/id/postinfo", - "DetailUrl": "https://basisregisters.vlaanderen.be/api/v1/postinfo/{0}", - "VolgendeUrl": "https://basisregisters.vlaanderen.be/api/v1/postinfo?offset={0}&limit={1}", - - "GemeenteNaamruimte": "https://data.vlaanderen.be/id/gemeente", - "GemeenteDetailUrl": "https://basisregisters.vlaanderen.be/api/v1/gemeenten/{0}", - - "Serilog": { - "MinimumLevel": { - "Default": "Information" - }, - "WriteTo": [ - { - "Name": "Console", - "Args": { - "formatter": "Serilog.Formatting.Compact.RenderedCompactJsonFormatter, Serilog.Formatting.Compact" - } - } - ], - "Properties": { - "Application": "PostalRegistry - Legacy API", - "ContainerId": "REPLACE_CONTAINERID" - } - } -} diff --git a/src/PostalRegistry.Api.Legacy/init.sh b/src/PostalRegistry.Api.Legacy/init.sh deleted file mode 100755 index 27fcf05d..00000000 --- a/src/PostalRegistry.Api.Legacy/init.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -CONTAINERID=$(curl -s http://169.254.170.2/v2/metadata | jq -r ".Containers[] | select(.Labels[\"com.amazonaws.ecs.container-name\"] | startswith(\"basisregisters-\") and endswith(\"-legacy\")) | .DockerId") - -sed -i "s/REPLACE_CONTAINERID/$CONTAINERID/g" appsettings.json - -./PostalRegistry.Api.Legacy diff --git a/src/PostalRegistry.Api.Legacy/paket.references b/src/PostalRegistry.Api.Legacy/paket.references deleted file mode 100755 index 14ee5199..00000000 --- a/src/PostalRegistry.Api.Legacy/paket.references +++ /dev/null @@ -1,10 +0,0 @@ -Be.Vlaanderen.Basisregisters.AggregateSource -Be.Vlaanderen.Basisregisters.Api -Be.Vlaanderen.Basisregisters.EventHandling.Autofac - -AspNetCore.HealthChecks.SqlServer - -Datadog.Trace.Bundle - -SourceLink.Embed.AllSourceFiles -SourceLink.Copy.PdbFiles diff --git a/src/PostalRegistry.Api.Legacy/paket.template b/src/PostalRegistry.Api.Legacy/paket.template deleted file mode 100755 index d6db0a42..00000000 --- a/src/PostalRegistry.Api.Legacy/paket.template +++ /dev/null @@ -1,38 +0,0 @@ -type file -version 1.0.0 - -id Be.Vlaanderen.Basisregisters.PostalRegistry.Api.Legacy -title Be.Vlaanderen.Basisregisters.PostalRegistry.Api.Legacy - -authors Basisregisters Vlaanderen -owners Digitaal Vlaanderen -copyright Copyright (c) Digitaal Vlaanderen -requireLicenseAcceptance false -projectUrl https://github.com/Informatievlaanderen/postal-registry -iconUrl https://raw.githubusercontent.com/Informatievlaanderen/build-pipeline/master/logo.png -licenseUrl https://opensource.org/licenses/EUPL-1.2 - -description Postal Registry. - -dependencies - framework: net8.0 - Be.Vlaanderen.Basisregisters.Shaperon >= LOCKEDVERSION - Be.Vlaanderen.Basisregisters.AggregateSource >= LOCKEDVERSION - Be.Vlaanderen.Basisregisters.Api >= LOCKEDVERSION - Be.Vlaanderen.Basisregisters.EventHandling.Autofac >= LOCKEDVERSION - AspNetCore.HealthChecks.SqlServer >= LOCKEDVERSION - -files - PostalRegistry.Api.Legacy.dll => lib\net8.0 - PostalRegistry.Api.Legacy.pdb => lib\net8.0 - PostalRegistry.Api.Legacy.xml => lib\net8.0 - PostalRegistry.Api.Legacy.xml => content - - PostalRegistry.Projections.Legacy.dll => lib\net8.0 - PostalRegistry.Projections.Legacy.pdb => lib\net8.0 - - PostalRegistry.Projections.Syndication.dll => lib\net8.0 - PostalRegistry.Projections.Syndication.pdb => lib\net8.0 - - PostalRegistry.dll => lib\net8.0 - PostalRegistry.pdb => lib\net8.0