diff --git a/src/StreetNameRegistry.Api.Legacy/Infrastructure/Modules/ApiModule.cs b/src/StreetNameRegistry.Api.Legacy/Infrastructure/Modules/ApiModule.cs index bc0767043..e6385d47f 100644 --- a/src/StreetNameRegistry.Api.Legacy/Infrastructure/Modules/ApiModule.cs +++ b/src/StreetNameRegistry.Api.Legacy/Infrastructure/Modules/ApiModule.cs @@ -5,6 +5,7 @@ namespace StreetNameRegistry.Api.Legacy.Infrastructure.Modules using Autofac.Extensions.DependencyInjection; using Be.Vlaanderen.Basisregisters.Api.Exceptions; using Be.Vlaanderen.Basisregisters.DependencyInjection; + using Consumer.Read.Postal.Infrastructure.Modules; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -35,7 +36,8 @@ protected override void Load(ContainerBuilder builder) .RegisterModule(new LegacyModule(_configuration, _services, _loggerFactory)); builder - .RegisterModule(new SyndicationModule(_configuration, _services, _loggerFactory)); + .RegisterModule(new SyndicationModule(_configuration, _services, _loggerFactory)) + .RegisterModule(new ConsumerPostalModule(_configuration, _services, _loggerFactory)); builder .RegisterType() diff --git a/src/StreetNameRegistry.Api.Legacy/Infrastructure/Modules/MediatRModule.cs b/src/StreetNameRegistry.Api.Legacy/Infrastructure/Modules/MediatRModule.cs index 9034201d4..adf589b9a 100644 --- a/src/StreetNameRegistry.Api.Legacy/Infrastructure/Modules/MediatRModule.cs +++ b/src/StreetNameRegistry.Api.Legacy/Infrastructure/Modules/MediatRModule.cs @@ -2,6 +2,7 @@ namespace StreetNameRegistry.Api.Legacy.Infrastructure.Modules { using Autofac; using Be.Vlaanderen.Basisregisters.GrAr.Legacy; + using Consumer.Read.Postal; using FeatureToggles; using MediatR; using Microsoft.Extensions.Options; @@ -36,6 +37,7 @@ protected override void Load(ContainerBuilder builder) new ListHandlerV2( c.Resolve(), c.Resolve(), + c.Resolve(), c.Resolve>()); } @@ -43,6 +45,7 @@ protected override void Load(ContainerBuilder builder) new ListHandler( c.Resolve(), c.Resolve(), + c.Resolve(), c.Resolve>()); }).InstancePerLifetimeScope(); @@ -72,13 +75,16 @@ protected override void Load(ContainerBuilder builder) return (IRequestHandler) new CountHandlerV2( c.Resolve(), - c.Resolve()); + c.Resolve(), + c.Resolve()); } return (IRequestHandler) new CountHandler( c.Resolve(), - c.Resolve()); + c.Resolve(), + c.Resolve()); + }).InstancePerLifetimeScope(); builder.Register(c => diff --git a/src/StreetNameRegistry.Api.Legacy/StreetName/Count/CountHandler.cs b/src/StreetNameRegistry.Api.Legacy/StreetName/Count/CountHandler.cs index a2838b4a4..0d407dac7 100644 --- a/src/StreetNameRegistry.Api.Legacy/StreetName/Count/CountHandler.cs +++ b/src/StreetNameRegistry.Api.Legacy/StreetName/Count/CountHandler.cs @@ -5,6 +5,7 @@ namespace StreetNameRegistry.Api.Legacy.StreetName.Count using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Search.Pagination; using Be.Vlaanderen.Basisregisters.GrAr.Legacy; + using Consumer.Read.Postal; using Microsoft.EntityFrameworkCore; using Projections.Legacy; using Projections.Legacy.StreetNameList; @@ -15,11 +16,13 @@ public sealed class CountHandler : CountHandlerBase { private readonly LegacyContext _legacyContext; private readonly SyndicationContext _syndicationContext; + private readonly ConsumerPostalContext _postalContext; - public CountHandler(LegacyContext legacyContext, SyndicationContext syndicationContext) + public CountHandler(LegacyContext legacyContext, SyndicationContext syndicationContext, ConsumerPostalContext postalContext) { _legacyContext = legacyContext; _syndicationContext = syndicationContext; + _postalContext = postalContext; } public override async Task Handle(CountRequest request, CancellationToken cancellationToken) @@ -29,7 +32,7 @@ public override async Task Handle(CountRequest request, Ca return new TotaalAantalResponse { Aantal = request.Filtering.ShouldFilter - ? await new StreetNameListQuery(_legacyContext, _syndicationContext) + ? await new StreetNameListQuery(_legacyContext, _syndicationContext, _postalContext) .Fetch(request.Filtering, request.Sorting, pagination) .Items .CountAsync(cancellationToken) diff --git a/src/StreetNameRegistry.Api.Legacy/StreetName/Count/CountHandlerV2.cs b/src/StreetNameRegistry.Api.Legacy/StreetName/Count/CountHandlerV2.cs index dbd03d315..31a565c0e 100644 --- a/src/StreetNameRegistry.Api.Legacy/StreetName/Count/CountHandlerV2.cs +++ b/src/StreetNameRegistry.Api.Legacy/StreetName/Count/CountHandlerV2.cs @@ -4,6 +4,7 @@ namespace StreetNameRegistry.Api.Legacy.StreetName.Count using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Search.Pagination; using Be.Vlaanderen.Basisregisters.GrAr.Legacy; + using Consumer.Read.Postal; using Microsoft.EntityFrameworkCore; using Projections.Legacy; using Projections.Legacy.StreetNameListV2; @@ -14,11 +15,13 @@ public sealed class CountHandlerV2 : CountHandlerBase { private readonly LegacyContext _legacyContext; private readonly SyndicationContext _syndicationContext; + private readonly ConsumerPostalContext _postalContext; - public CountHandlerV2(LegacyContext legacyContext, SyndicationContext syndicationContext) + public CountHandlerV2(LegacyContext legacyContext, SyndicationContext syndicationContext, ConsumerPostalContext postalContext) { _legacyContext = legacyContext; _syndicationContext = syndicationContext; + _postalContext = postalContext; } public override async Task Handle(CountRequest request, CancellationToken cancellationToken) @@ -28,7 +31,7 @@ public override async Task Handle(CountRequest request, Ca return new TotaalAantalResponse { - Aantal = await new StreetNameListQueryV2(_legacyContext, _syndicationContext) + Aantal = await new StreetNameListQueryV2(_legacyContext, _syndicationContext, _postalContext) .Fetch(request.Filtering, request.Sorting, pagination) .Items .CountAsync(cancellationToken) diff --git a/src/StreetNameRegistry.Api.Legacy/StreetName/List/ListHandler.cs b/src/StreetNameRegistry.Api.Legacy/StreetName/List/ListHandler.cs index 4cb37d74c..21cee7f10 100644 --- a/src/StreetNameRegistry.Api.Legacy/StreetName/List/ListHandler.cs +++ b/src/StreetNameRegistry.Api.Legacy/StreetName/List/ListHandler.cs @@ -5,6 +5,7 @@ namespace StreetNameRegistry.Api.Legacy.StreetName.List using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.GrAr.Common; using Be.Vlaanderen.Basisregisters.GrAr.Legacy; + using Consumer.Read.Postal; using Convertors; using Infrastructure.Options; using Microsoft.EntityFrameworkCore; @@ -19,21 +20,24 @@ public sealed class ListHandler : ListHandlerBase { private readonly LegacyContext _legacyContext; private readonly SyndicationContext _syndicationContext; + private readonly ConsumerPostalContext _PostalContext; private readonly IOptions _responseOptions; public ListHandler( LegacyContext legacyContext, SyndicationContext syndicationContext, + ConsumerPostalContext postalContext, IOptions responseOptions) { _legacyContext = legacyContext; _syndicationContext = syndicationContext; + _PostalContext = postalContext; _responseOptions = responseOptions; } public override async Task Handle(ListRequest request, CancellationToken cancellationToken) { - var streetNameQuery = new StreetNameListQuery(_legacyContext, _syndicationContext) + var streetNameQuery = new StreetNameListQuery(_legacyContext, _syndicationContext, _PostalContext) .Fetch(request.Filtering, request.Sorting, request.Pagination); var pagedStreetNames = await streetNameQuery diff --git a/src/StreetNameRegistry.Api.Legacy/StreetName/List/ListHandlerV2.cs b/src/StreetNameRegistry.Api.Legacy/StreetName/List/ListHandlerV2.cs index 89355e0cc..ba27e5101 100644 --- a/src/StreetNameRegistry.Api.Legacy/StreetName/List/ListHandlerV2.cs +++ b/src/StreetNameRegistry.Api.Legacy/StreetName/List/ListHandlerV2.cs @@ -5,6 +5,7 @@ namespace StreetNameRegistry.Api.Legacy.StreetName.List using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.GrAr.Common; using Be.Vlaanderen.Basisregisters.GrAr.Legacy; + using Consumer.Read.Postal; using Convertors; using Infrastructure.Options; using Microsoft.EntityFrameworkCore; @@ -19,21 +20,25 @@ public sealed class ListHandlerV2 : ListHandlerBase { private readonly LegacyContext _legacyContext; private readonly SyndicationContext _syndicationContext; + private readonly ConsumerPostalContext _postalContext; + private readonly IOptions _responseOptions; public ListHandlerV2( LegacyContext legacyContext, SyndicationContext syndicationContext, + ConsumerPostalContext postalContext, IOptions responseOptions) { _legacyContext = legacyContext; _syndicationContext = syndicationContext; + _postalContext = postalContext; _responseOptions = responseOptions; } public override async Task Handle(ListRequest request, CancellationToken cancellationToken) { - var streetNameQuery = new StreetNameListQueryV2(_legacyContext, _syndicationContext) + var streetNameQuery = new StreetNameListQueryV2(_legacyContext, _syndicationContext, _postalContext) .Fetch(request.Filtering, request.Sorting, request.Pagination); var pagedStreetNames = await streetNameQuery diff --git a/src/StreetNameRegistry.Api.Legacy/StreetName/Query/StreetNameListQuery.cs b/src/StreetNameRegistry.Api.Legacy/StreetName/Query/StreetNameListQuery.cs index f5d5a6df5..1012f08c3 100755 --- a/src/StreetNameRegistry.Api.Legacy/StreetName/Query/StreetNameListQuery.cs +++ b/src/StreetNameRegistry.Api.Legacy/StreetName/Query/StreetNameListQuery.cs @@ -8,6 +8,7 @@ namespace StreetNameRegistry.Api.Legacy.StreetName.Query using Be.Vlaanderen.Basisregisters.Api.Search.Sorting; using Be.Vlaanderen.Basisregisters.GrAr.Common; using Be.Vlaanderen.Basisregisters.GrAr.Legacy.Straatnaam; + using Consumer.Read.Postal; using Convertors; using Microsoft.EntityFrameworkCore; using Projections.Legacy; @@ -18,13 +19,15 @@ public sealed class StreetNameListQuery : Query new StreetNameSorting(); - public StreetNameListQuery(LegacyContext legacyContext, SyndicationContext syndicationContext) + public StreetNameListQuery(LegacyContext legacyContext, SyndicationContext syndicationContext, ConsumerPostalContext postalContext) { _legacyContext = legacyContext; _syndicationContext = syndicationContext; + _postalContext = postalContext; } protected override IQueryable Filter(FilteringHeader filtering) @@ -89,6 +92,15 @@ protected override IQueryable Filter(FilteringHeader m.NisCode == postalConsumerItem.NisCode); + } + } + return streetNames; } @@ -138,5 +150,6 @@ public sealed class StreetNameFilter public string NameEnglish { get; set; } = string.Empty; public string Status { get; set; } = string.Empty; public string? NisCode { get; set; } = string.Empty; + public string? PostalCode { get; set; } = string.Empty; } } diff --git a/src/StreetNameRegistry.Api.Legacy/StreetName/Query/StreetNameListQueryV2.cs b/src/StreetNameRegistry.Api.Legacy/StreetName/Query/StreetNameListQueryV2.cs index 5a0dc2688..7692c0638 100644 --- a/src/StreetNameRegistry.Api.Legacy/StreetName/Query/StreetNameListQueryV2.cs +++ b/src/StreetNameRegistry.Api.Legacy/StreetName/Query/StreetNameListQueryV2.cs @@ -7,6 +7,7 @@ namespace StreetNameRegistry.Api.Legacy.StreetName.Query using Be.Vlaanderen.Basisregisters.Api.Search.Sorting; using Be.Vlaanderen.Basisregisters.GrAr.Common; using Be.Vlaanderen.Basisregisters.GrAr.Legacy.Straatnaam; + using Consumer.Read.Postal; using Convertors; using Microsoft.EntityFrameworkCore; using Projections.Legacy; @@ -17,13 +18,15 @@ public sealed class StreetNameListQueryV2 : Query new StreetNameSorting(); - public StreetNameListQueryV2(LegacyContext legacyContext, SyndicationContext syndicationContext) + public StreetNameListQueryV2(LegacyContext legacyContext, SyndicationContext syndicationContext, ConsumerPostalContext postalContext) { _legacyContext = legacyContext; _syndicationContext = syndicationContext; + _PostalContext = postalContext; } protected override IQueryable Filter(FilteringHeader filtering) @@ -107,6 +110,15 @@ protected override IQueryable Filter(FilteringHeader m.NisCode == postalConsumerItem.NisCode); + } + } + return streetNames; } } diff --git a/src/StreetNameRegistry.Api.Legacy/StreetNameRegistry.Api.Legacy.csproj b/src/StreetNameRegistry.Api.Legacy/StreetNameRegistry.Api.Legacy.csproj index 7d580434e..a2083934a 100644 --- a/src/StreetNameRegistry.Api.Legacy/StreetNameRegistry.Api.Legacy.csproj +++ b/src/StreetNameRegistry.Api.Legacy/StreetNameRegistry.Api.Legacy.csproj @@ -35,6 +35,7 @@ + diff --git a/src/StreetNameRegistry.Api.Legacy/appsettings.json b/src/StreetNameRegistry.Api.Legacy/appsettings.json index 85cf7b473..c2f69a55b 100755 --- a/src/StreetNameRegistry.Api.Legacy/appsettings.json +++ b/src/StreetNameRegistry.Api.Legacy/appsettings.json @@ -3,7 +3,8 @@ "Events": "Server=(localdb)\\mssqllocaldb;Database=EFProviders.InMemory.StreetNameRegistry;Trusted_Connection=True;TrustServerCertificate=True;", "LegacyProjections": "Server=(localdb)\\mssqllocaldb;Database=EFProviders.InMemory.StreetNameRegistry;Trusted_Connection=True;TrustServerCertificate=True;", "SyndicationProjections": "Server=(localdb)\\mssqllocaldb;Database=EFProviders.InMemory.StreetNameRegistry;Trusted_Connection=True;TrustServerCertificate=True;", - "LegacyProjectionsAdmin": "Server=(localdb)\\mssqllocaldb;Database=EFProviders.InMemory.StreetNameRegistry;Trusted_Connection=True;TrustServerCertificate=True;" + "LegacyProjectionsAdmin": "Server=(localdb)\\mssqllocaldb;Database=EFProviders.InMemory.StreetNameRegistry;Trusted_Connection=True;TrustServerCertificate=True;", + "ConsumerPostal": "Server=(localdb)\\mssqllocaldb;Database=EFProviders.InMemory.StreetNameRegistry;Trusted_Connection=True;TrustServerCertificate=True;" }, "DataDog": {