Skip to content

Commit

Permalink
feat: suspicious cases sort by Description for address/streetname (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
rikdepeuter authored Nov 27, 2024
1 parent f45449f commit 0124116
Showing 1 changed file with 47 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,66 +42,78 @@ public async Task<IEnumerable<SuspiciousCase>> GetSuspiciousCase(
{
switch (type)
{
// Address
case SuspiciousCasesType.CurrentAddressWithoutLinkedParcelsOrBuildingUnits:
return await CurrentAddressesWithoutLinkedParcelOrBuilding
.Where(x => x.NisCode == nisCode)
.OrderBy(x => x.AddressPersistentLocalId)
.OrderBy(x => x.Description)
.Skip(offset)
.Take(limit)
.ToListAsync(ct);
case SuspiciousCasesType.ProposedAddressWithoutLinkedParcelOrBuildingUnit:
return await ProposedAddressesWithoutLinkedParcelOrBuilding
.Where(x => x.NisCode == nisCode)
.OrderBy(x => x.AddressPersistentLocalId)
.OrderBy(x => x.Description)
.Skip(offset)
.Take(limit)
.ToListAsync(ct);
case SuspiciousCasesType.ActiveAddressOutsideOfMunicipalityBounds:
return await ActiveAddressesOutsideMunicipalityBounds
.Where(x => x.NisCode == nisCode)
.OrderBy(x => x.AddressPersistentLocalId)
.OrderBy(x => x.Description)
.Skip(offset)
.Take(limit)
.ToListAsync(ct);
case SuspiciousCasesType.CurrentStreetNameWithoutLinkedRoadSegment:
return await CurrentStreetNamesWithoutLinkedRoadSegments
case SuspiciousCasesType.AddressLongerThanTwoYearsProposed:
return await AddressesLongerThanTwoYearsProposed
.Where(x => x.NisCode == nisCode)
.OrderBy(x => x.StreetNamePersistentLocalId)
.OrderBy(x => x.Description)
.Skip(offset)
.Take(limit)
.ToListAsync(ct);
case SuspiciousCasesType.StreetNameLongerThanTwoYearsProposed:
return await StreetNamesLongerThanTwoYearsProposed
case SuspiciousCasesType.CurrentAddressesWithSpecificationDerivedFromBuildingUnitWithoutLinkedBuildingUnit:
return await CurrentAddressesWithSpecificationDerivedFromBuildingUnitWithoutLinkedBuildingUnit
.Where(x => x.NisCode == nisCode)
.OrderBy(x => x.StreetNamePersistentLocalId)
.OrderBy(x => x.Description)
.Skip(offset)
.Take(limit)
.ToListAsync(ct);
case SuspiciousCasesType.AddressLongerThanTwoYearsProposed:
return await AddressesLongerThanTwoYearsProposed
case SuspiciousCasesType.ActiveAddressLinkedToMultipleBuildingUnits:
return await ActiveAddressesLinkedToMultipleBuildingUnits
.Where(x => x.NisCode == nisCode)
.OrderBy(x => x.AddressPersistentLocalId)
.OrderBy(x => x.Description)
.Skip(offset)
.Take(limit)
.ToListAsync(ct);
case SuspiciousCasesType.RoadSegmentLongerThanTwoYearsWithPermit:
return await RoadSegmentsLongerThanTwoYearsWithPermit
case SuspiciousCasesType.CurrentAddressLinkedWithBuildingUnitButNotWithParcel:
return await CurrentAddressesLinkedWithBuildingUnitButNotWithParcel
.Where(x => x.NisCode == nisCode)
.OrderBy(x => x.RoadSegmentPersistentLocalId)
.OrderBy(x => x.Description)
.Skip(offset)
.Take(limit)
.ToListAsync(ct);
case SuspiciousCasesType.BuildingLongerThanTwoYearsPlanned:
return await BuildingsLongerThanTwoYearsPlanned

// StreetName
case SuspiciousCasesType.CurrentStreetNameWithoutLinkedRoadSegment:
return await CurrentStreetNamesWithoutLinkedRoadSegments
.Where(x => x.NisCode == nisCode)
.OrderBy(x => x.BuildingPersistentLocalId)
.OrderBy(x => x.Description)
.Skip(offset)
.Take(limit)
.ToListAsync(ct);
case SuspiciousCasesType.BuildingUnitLongerThanTwoYearsPlanned:
return await BuildingUnitsLongerThanTwoYearsPlanned
case SuspiciousCasesType.StreetNameLongerThanTwoYearsProposed:
return await StreetNamesLongerThanTwoYearsProposed
.Where(x => x.NisCode == nisCode)
.OrderBy(x => x.BuildingUnitPersistentLocalId)
.OrderBy(x => x.Description)
.Skip(offset)
.Take(limit)
.ToListAsync(ct);

// RoadSegment
case SuspiciousCasesType.RoadSegmentLongerThanTwoYearsWithPermit:
return await RoadSegmentsLongerThanTwoYearsWithPermit
.Where(x => x.NisCode == nisCode)
.OrderBy(x => x.RoadSegmentPersistentLocalId)
.Skip(offset)
.Take(limit)
.ToListAsync(ct);
Expand All @@ -112,10 +124,21 @@ public async Task<IEnumerable<SuspiciousCase>> GetSuspiciousCase(
.Skip(offset)
.Take(limit)
.ToListAsync(ct);
case SuspiciousCasesType.CurrentAddressesWithSpecificationDerivedFromBuildingUnitWithoutLinkedBuildingUnit:
return await CurrentAddressesWithSpecificationDerivedFromBuildingUnitWithoutLinkedBuildingUnit

// Building
case SuspiciousCasesType.BuildingLongerThanTwoYearsPlanned:
return await BuildingsLongerThanTwoYearsPlanned
.Where(x => x.NisCode == nisCode)
.OrderBy(x => x.AddressPersistentLocalId)
.OrderBy(x => x.BuildingPersistentLocalId)
.Skip(offset)
.Take(limit)
.ToListAsync(ct);

// BuildingUnit
case SuspiciousCasesType.BuildingUnitLongerThanTwoYearsPlanned:
return await BuildingUnitsLongerThanTwoYearsPlanned
.Where(x => x.NisCode == nisCode)
.OrderBy(x => x.BuildingUnitPersistentLocalId)
.Skip(offset)
.Take(limit)
.ToListAsync(ct);
Expand All @@ -133,20 +156,6 @@ public async Task<IEnumerable<SuspiciousCase>> GetSuspiciousCase(
// .Skip(offset)
// .Take(limit)
// .ToListAsync(ct);
case SuspiciousCasesType.ActiveAddressLinkedToMultipleBuildingUnits:
return await ActiveAddressesLinkedToMultipleBuildingUnits
.Where(x => x.NisCode == nisCode)
.OrderBy(x => x.AddressPersistentLocalId)
.Skip(offset)
.Take(limit)
.ToListAsync(ct);
case SuspiciousCasesType.CurrentAddressLinkedWithBuildingUnitButNotWithParcel:
return await CurrentAddressesLinkedWithBuildingUnitButNotWithParcel
.Where(x => x.NisCode == nisCode)
.OrderBy(x => x.AddressPersistentLocalId)
.Skip(offset)
.Take(limit)
.ToListAsync(ct);
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
Expand Down

0 comments on commit 0124116

Please sign in to comment.