diff --git a/src/Basisregisters.IntegrationDb.SuspiciousCases.Api.Abstractions/SuspiciousCase.cs b/src/Basisregisters.IntegrationDb.SuspiciousCases.Api.Abstractions/SuspiciousCase.cs
index 84b5e97..b46a290 100644
--- a/src/Basisregisters.IntegrationDb.SuspiciousCases.Api.Abstractions/SuspiciousCase.cs
+++ b/src/Basisregisters.IntegrationDb.SuspiciousCases.Api.Abstractions/SuspiciousCase.cs
@@ -66,6 +66,10 @@ public class SuspiciousCase
// SuspiciousCasesType.ActiveBuildingUnitLinkedToMultipleAddresses,
// new SuspiciousCase(Category.BuildingUnit, "Gebouweenheden met status 'gepland' of 'gerealiseerd' die gekoppeld zijn aan meerdere adressen", Severity.Improvable)
// },
+ {
+ SuspiciousCasesType.CurrentAddressLinkedToProposedStreetName,
+ new SuspiciousCase(Category.Address, "Adres \"in gebruik\" met koppeling naar een straatnaam met de status \"voorgesteld\"", Severity.Suspicious)
+ },
};
public Category Category { get; }
diff --git a/src/Basisregisters.IntegrationDb.SuspiciousCases/Migrations/20241210123817_AddViewCurrentAddressLinkedToProposedStreetName.Designer.cs b/src/Basisregisters.IntegrationDb.SuspiciousCases/Migrations/20241210123817_AddViewCurrentAddressLinkedToProposedStreetName.Designer.cs
new file mode 100644
index 0000000..6019f2b
--- /dev/null
+++ b/src/Basisregisters.IntegrationDb.SuspiciousCases/Migrations/20241210123817_AddViewCurrentAddressLinkedToProposedStreetName.Designer.cs
@@ -0,0 +1,500 @@
+//
+using Basisregisters.IntegrationDb.SuspiciousCases;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace Basisregisters.IntegrationDb.SuspiciousCases.Migrations
+{
+ [DbContext(typeof(SuspiciousCasesContext))]
+ [Migration("20241210123817_AddViewCurrentAddressLinkedToProposedStreetName")]
+ partial class AddViewCurrentAddressLinkedToProposedStreetName
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.3")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis");
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.ActiveAddresLinkedToMultipleBuildingUnits", b =>
+ {
+ b.Property("AddressPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("address_persistent_local_id");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_active_address_linked_to_multiple_building_units", "integration_suspicious_cases");
+
+ b.ToSqlQuery("\r\n SELECT\r\n persistent_local_id,\r\n address_persistent_local_id,\r\n nis_code,\r\n description\r\n FROM integration_suspicious_cases.view_active_address_linked_to_multiple_building_units");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.ActiveAddressOutsideMunicipalityBounds", b =>
+ {
+ b.Property("AddressPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("address_persistent_local_id");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_active_address_outside_municipality_bounds", "integration_suspicious_cases");
+
+ b.ToSqlQuery("\r\n SELECT\r\n persistent_local_id,\r\n address_persistent_local_id,\r\n nis_code,\r\n description\r\n FROM integration_suspicious_cases.view_active_address_outside_municipality_bounds");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.ActiveBuildingUnitLinkedToMultipleAddresses", b =>
+ {
+ b.Property("BuildingUnitPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("building_unit_persistent_local_id");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_building_unit_linked_to_multiple_addresses", "integration_suspicious_cases");
+
+ b.ToSqlQuery("SELECT\r\n persistent_local_id,\r\n building_unit_persistent_local_id,\r\n nis_code,\r\n CONCAT('Gebouweenheid-', building_unit_persistent_local_id) as description\r\n FROM integration_suspicious_cases.view_building_unit_linked_to_multiple_addresses");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.AddressLongerThanTwoYearsProposed", b =>
+ {
+ b.Property("AddressPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("address_persistent_local_id");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_address_longer_than_two_years_proposed", "integration_suspicious_cases");
+
+ b.ToSqlQuery("\r\n SELECT\r\n persistent_local_id,\r\n address_persistent_local_id,\r\n nis_code,\r\n description\r\n FROM integration_suspicious_cases.view_address_longer_than_two_years_proposed");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.BuildingLongerThanTwoYearsPlanned", b =>
+ {
+ b.Property("BuildingPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("building_persistent_local_id");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_buildings_longer_than_two_years_planned", "integration_suspicious_cases");
+
+ b.ToSqlQuery("\r\n SELECT\r\n persistent_local_id,\r\n building_persistent_local_id,\r\n nis_code,\r\n CONCAT('Gebouw-', building_persistent_local_id) as description\r\n FROM integration_suspicious_cases.view_buildings_longer_than_two_years_planned");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.BuildingUnitsLongerThanTwoYearsPlanned", b =>
+ {
+ b.Property("BuildingUnitPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("building_unit_persistent_local_id");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_building_unit_longer_than_two_years_planned", "integration_suspicious_cases");
+
+ b.ToSqlQuery("\r\n SELECT\r\n persistent_local_id,\r\n building_unit_persistent_local_id,\r\n nis_code,\r\n CONCAT('Gebouweenheden-', building_unit_persistent_local_id) as description\r\n FROM integration_suspicious_cases.view_building_unit_longer_than_two_years_planned");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.CurrentAddressLinkedToProposedStreetName", b =>
+ {
+ b.Property("AddressPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("address_persistent_local_id");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_current_address_linked_to_proposed_streetname", "integration_suspicious_cases");
+
+ b.ToSqlQuery("\r\n SELECT\r\n persistent_local_id,\r\n address_persistent_local_id,\r\n nis_code,\r\n description\r\n FROM integration_suspicious_cases.view_current_address_linked_to_proposed_streetname");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.CurrentAddressLinkedWithBuildingUnitButNotWithParcel", b =>
+ {
+ b.Property("AddressPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("address_persistent_local_id");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_current_address_linked_with_building_unit_but_not_with_parcel", "integration_suspicious_cases");
+
+ b.ToSqlQuery("SELECT\r\n persistent_local_id,\r\n address_persistent_local_id,\r\n nis_code,\r\n description\r\n FROM integration_suspicious_cases.view_current_address_linked_with_building_unit_but_not_with_parcel");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.CurrentAddressWithSpecificationDerivedFromBuildingUnitWithoutLinkedBuildingUnit", b =>
+ {
+ b.Property("AddressPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("address_persistent_local_id");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_current_address_with_specification_derived_from_building_unit_without_linked_building_unit", "integration_suspicious_cases");
+
+ b.ToSqlQuery("\r\n SELECT\r\n persistent_local_id,\r\n address_persistent_local_id,\r\n nis_code,\r\n description\r\n FROM integration_suspicious_cases.view_current_address_with_specification_derived_from_building_unit_without_linked_building_unit");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.CurrentAddressWithoutLinkedParcelOrBuildingUnit", b =>
+ {
+ b.Property("AddressPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("address_persistent_local_id");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_current_address_without_linked_parcel_or_building_unit", "integration_suspicious_cases");
+
+ b.ToSqlQuery("SELECT\r\n persistent_local_id,\r\n address_persistent_local_id,\r\n nis_code,\r\n description\r\n FROM integration_suspicious_cases.view_current_address_without_linked_parcel_or_building_unit");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.CurrentStreetNameWithoutLinkedRoadSegments", b =>
+ {
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.Property("StreetNamePersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("streetname_persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_current_street_name_without_linked_road_segments", "integration_suspicious_cases");
+
+ b.ToSqlQuery("\r\n SELECT\r\n persistent_local_id,\r\n streetname_persistent_local_id,\r\n nis_code,\r\n description\r\n FROM integration_suspicious_cases.view_current_street_name_without_linked_road_segments");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.Internal.ActiveBuildingUnitWithoutAddress", b =>
+ {
+ b.Property("BuildingUnitPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("building_unit_persistent_local_id");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_active_building_unit_without_address", "integration_suspicious_cases");
+
+ b.ToSqlQuery("\r\n SELECT\r\n persistent_local_id,\r\n building_unit_persistent_local_id,\r\n nis_code,\r\n CONCAT('Gebouweenheid-', building_unit_persistent_local_id) as description\r\n FROM integration_suspicious_cases.view_active_building_unit_without_address");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.ProposedAddressWithoutLinkedParcelOrBuildingUnit", b =>
+ {
+ b.Property("AddressPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("address_persistent_local_id");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_proposed_address_without_linked_parcel_or_building_unit", "integration_suspicious_cases");
+
+ b.ToSqlQuery("SELECT\r\n persistent_local_id,\r\n address_persistent_local_id,\r\n nis_code,\r\n description\r\n FROM integration_suspicious_cases.view_proposed_address_without_linked_parcel_or_building_unit");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.RoadSegmentLongerThanTwoYearsWithPermit", b =>
+ {
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.Property("RoadSegmentPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("road_segment_persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_road_segment_longer_than_two_years_with_permit", "integration_suspicious_cases");
+
+ b.ToSqlQuery("\r\n SELECT\r\n persistent_local_id,\r\n road_segment_persistent_local_id,\r\n nis_code,\r\n CONCAT('Wegsegment-', road_segment_persistent_local_id) as description\r\n FROM integration_suspicious_cases.view_road_segment_longer_than_two_years_with_permit");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.RoadSegmentWithSingleLinkedStreetName", b =>
+ {
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.Property("RoadSegmentPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("road_segment_persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_road_segment_with_single_linked_streetname", "integration_suspicious_cases");
+
+ b.ToSqlQuery("\r\n SELECT\r\n persistent_local_id,\r\n road_segment_persistent_local_id,\r\n nis_code,\r\n CONCAT('Wegsegment-', road_segment_persistent_local_id) as description\r\n FROM integration_suspicious_cases.view_road_segment_with_single_linked_streetname");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.StreetNameLongerThanTwoYearsProposed", b =>
+ {
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.Property("StreetNamePersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("streetname_persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_streetname_longer_than_two_years_proposed", "integration_suspicious_cases");
+
+ b.ToSqlQuery("\r\n SELECT\r\n persistent_local_id,\r\n streetname_persistent_local_id,\r\n nis_code,\r\n description\r\n FROM integration_suspicious_cases.view_streetname_longer_than_two_years_proposed");
+ });
+
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.SuspiciousCaseCount", b =>
+ {
+ b.Property("Count")
+ .HasColumnType("integer")
+ .HasColumnName("count");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("Type")
+ .HasColumnType("integer")
+ .HasColumnName("type");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_suspicious_cases_counts", "integration_suspicious_cases");
+
+ b.ToSqlQuery("select\r\n nis_code,\r\n count,\r\n type\r\n FROM integration_suspicious_cases.view_suspicious_cases_counts");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/src/Basisregisters.IntegrationDb.SuspiciousCases/Migrations/20241210123817_AddViewCurrentAddressLinkedToProposedStreetName.cs b/src/Basisregisters.IntegrationDb.SuspiciousCases/Migrations/20241210123817_AddViewCurrentAddressLinkedToProposedStreetName.cs
new file mode 100644
index 0000000..9ed1a3c
--- /dev/null
+++ b/src/Basisregisters.IntegrationDb.SuspiciousCases/Migrations/20241210123817_AddViewCurrentAddressLinkedToProposedStreetName.cs
@@ -0,0 +1,30 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Basisregisters.IntegrationDb.SuspiciousCases.Migrations
+{
+ using System;
+ using Infrastructure;
+ using Views;
+
+ ///
+ public partial class AddViewCurrentAddressLinkedToProposedStreetName : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.Sql($"DROP VIEW IF EXISTS {Schema.SuspiciousCases}.{CurrentAddressLinkedToProposedStreetNameConfiguration.ViewName};");
+
+ migrationBuilder.Sql(CurrentAddressLinkedToProposedStreetNameConfiguration.Create);
+
+ migrationBuilder.Sql(SuspiciousCaseCountConfiguration.Create);
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ throw new NotSupportedException();
+ }
+ }
+}
diff --git a/src/Basisregisters.IntegrationDb.SuspiciousCases/Migrations/SuspiciousCasesContextModelSnapshot.cs b/src/Basisregisters.IntegrationDb.SuspiciousCases/Migrations/SuspiciousCasesContextModelSnapshot.cs
index 8cabe1d..778bc50 100644
--- a/src/Basisregisters.IntegrationDb.SuspiciousCases/Migrations/SuspiciousCasesContextModelSnapshot.cs
+++ b/src/Basisregisters.IntegrationDb.SuspiciousCases/Migrations/SuspiciousCasesContextModelSnapshot.cs
@@ -190,6 +190,34 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToSqlQuery("\r\n SELECT\r\n persistent_local_id,\r\n building_unit_persistent_local_id,\r\n nis_code,\r\n CONCAT('Gebouweenheden-', building_unit_persistent_local_id) as description\r\n FROM integration_suspicious_cases.view_building_unit_longer_than_two_years_planned");
});
+ modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.CurrentAddressLinkedToProposedStreetName", b =>
+ {
+ b.Property("AddressPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("address_persistent_local_id");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("description");
+
+ b.Property("NisCode")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("nis_code");
+
+ b.Property("PersistentLocalId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("persistent_local_id");
+
+ b.ToTable((string)null);
+
+ b.ToView("view_current_address_linked_to_proposed_streetname", "integration_suspicious_cases");
+
+ b.ToSqlQuery("\r\n SELECT\r\n persistent_local_id,\r\n address_persistent_local_id,\r\n nis_code,\r\n description\r\n FROM integration_suspicious_cases.view_current_address_linked_to_proposed_streetname");
+ });
+
modelBuilder.Entity("Basisregisters.IntegrationDb.SuspiciousCases.Views.CurrentAddressLinkedWithBuildingUnitButNotWithParcel", b =>
{
b.Property("AddressPersistentLocalId")
diff --git a/src/Basisregisters.IntegrationDb.SuspiciousCases/SuspiciousCasesContext.cs b/src/Basisregisters.IntegrationDb.SuspiciousCases/SuspiciousCasesContext.cs
index f472f1d..308d7a3 100644
--- a/src/Basisregisters.IntegrationDb.SuspiciousCases/SuspiciousCasesContext.cs
+++ b/src/Basisregisters.IntegrationDb.SuspiciousCases/SuspiciousCasesContext.cs
@@ -22,6 +22,7 @@ public class SuspiciousCasesContext : DbContext
public DbSet ProposedAddressesWithoutLinkedParcelOrBuilding => Set();
public DbSet StreetNamesLongerThanTwoYearsProposed => Set();
public DbSet AddressesLongerThanTwoYearsProposed => Set();
+ public DbSet CurrentAddressesLinkedToProposedStreetName => Set();
public DbSet BuildingsLongerThanTwoYearsPlanned => Set();
public DbSet BuildingUnitsLongerThanTwoYearsPlanned => Set();
public DbSet ActiveAddressesOutsideMunicipalityBounds => Set();
@@ -92,6 +93,13 @@ public async Task> GetSuspiciousCase(
.Skip(offset)
.Take(limit)
.ToListAsync(ct);
+ case SuspiciousCasesType.CurrentAddressLinkedToProposedStreetName:
+ return await CurrentAddressesLinkedToProposedStreetName
+ .Where(x => x.NisCode == nisCode)
+ .OrderBy(x => x.Description)
+ .Skip(offset)
+ .Take(limit)
+ .ToListAsync(ct);
// StreetName
case SuspiciousCasesType.CurrentStreetNameWithoutLinkedRoadSegment:
diff --git a/src/Basisregisters.IntegrationDb.SuspiciousCases/SuspiciousCasesType.cs b/src/Basisregisters.IntegrationDb.SuspiciousCases/SuspiciousCasesType.cs
index 795cf3c..fa7d3c8 100644
--- a/src/Basisregisters.IntegrationDb.SuspiciousCases/SuspiciousCasesType.cs
+++ b/src/Basisregisters.IntegrationDb.SuspiciousCases/SuspiciousCasesType.cs
@@ -16,7 +16,7 @@ public enum SuspiciousCasesType
BuildingUnitLongerThanTwoYearsPlanned = 12,
RoadSegmentLongerThanTwoYearsWithPermit = 13,
RoadSegmentWithSingleLinkedStreetName = 14,
-
// ActiveBuildingUnitLinkedToMultipleAddresses = 15,
+ CurrentAddressLinkedToProposedStreetName = 16,
}
}
diff --git a/src/Basisregisters.IntegrationDb.SuspiciousCases/Views/CurrentAddressLinkedToProposedStreetName.cs b/src/Basisregisters.IntegrationDb.SuspiciousCases/Views/CurrentAddressLinkedToProposedStreetName.cs
new file mode 100644
index 0000000..4d0442f
--- /dev/null
+++ b/src/Basisregisters.IntegrationDb.SuspiciousCases/Views/CurrentAddressLinkedToProposedStreetName.cs
@@ -0,0 +1,52 @@
+namespace Basisregisters.IntegrationDb.SuspiciousCases.Views
+{
+ using Infrastructure;
+ using Microsoft.EntityFrameworkCore;
+ using Microsoft.EntityFrameworkCore.Metadata.Builders;
+
+ public sealed class CurrentAddressLinkedToProposedStreetName : SuspiciousCase
+ {
+ public int AddressPersistentLocalId { get; set; }
+
+ public override Category Category => Category.Address;
+ }
+
+ public sealed class CurrentAddressLinkedToProposedStreetNameConfiguration : IEntityTypeConfiguration
+ {
+ public void Configure(EntityTypeBuilder builder)
+ {
+ builder
+ .ToView(ViewName, Schema.SuspiciousCases)
+ .HasNoKey()
+ .ToSqlQuery(@$"
+ SELECT
+ persistent_local_id,
+ address_persistent_local_id,
+ nis_code,
+ description
+ FROM {Schema.SuspiciousCases}.{ViewName}");
+
+ builder.Property(x => x.PersistentLocalId).HasColumnName("persistent_local_id");
+ builder.Property(x => x.AddressPersistentLocalId).HasColumnName("address_persistent_local_id");
+ builder.Property(x => x.NisCode).HasColumnName("nis_code");
+ builder.Property(x => x.Description).HasColumnName("description");
+ }
+
+ public const string ViewName = "view_current_address_linked_to_proposed_streetname";
+
+ public const string Create = $@"
+ CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
+ SELECT
+ CAST(a.persistent_local_id as varchar) AS persistent_local_id,
+ a.persistent_local_id AS address_persistent_local_id,
+ s.nis_code AS nis_code,
+ {Schema.FullAddress}(s.name_dutch, a.house_number, a.box_number, a.postal_code, m.name_dutch) as description
+ FROM {SchemaLatestItems.Address} AS a
+ JOIN {SchemaLatestItems.StreetName} s ON s.persistent_local_id = a.street_name_persistent_local_id AND s.status = 0
+ JOIN {SchemaLatestItems.Municipality} m ON s.municipality_id = m.municipality_id
+ WHERE
+ a.status = 2
+ AND a.removed = false
+ ;";
+ }
+}
diff --git a/src/Basisregisters.IntegrationDb.SuspiciousCases/Views/SuspiciousCaseCount.cs b/src/Basisregisters.IntegrationDb.SuspiciousCases/Views/SuspiciousCaseCount.cs
index 854929b..52991c8 100644
--- a/src/Basisregisters.IntegrationDb.SuspiciousCases/Views/SuspiciousCaseCount.cs
+++ b/src/Basisregisters.IntegrationDb.SuspiciousCases/Views/SuspiciousCaseCount.cs
@@ -70,6 +70,8 @@ CREATE MATERIALIZED VIEW {{Schema.SuspiciousCases}}.{{ViewName}}
UNION
{{CreateScript(SuspiciousCasesType.CurrentAddressesWithSpecificationDerivedFromBuildingUnitWithoutLinkedBuildingUnit, CurrentAddressWithSpecificationDerivedFromBuildingUnitWithoutLinkedBuildingUnitConfiguration.ViewName)}}
UNION
+ {{CreateScript(SuspiciousCasesType.CurrentAddressLinkedToProposedStreetName, CurrentAddressLinkedToProposedStreetNameConfiguration.ViewName)}}
+ UNION
{{CreateScript(SuspiciousCasesType.CurrentStreetNameWithoutLinkedRoadSegment, CurrentStreetNameWithoutLinkedRoadSegmentsConfiguration.ViewName)}}
UNION
{{CreateScript(SuspiciousCasesType.ProposedAddressWithoutLinkedParcelOrBuildingUnit, ProposedAddressWithoutLinkedParcelOrBuildingUnitConfiguration.ViewName)}}