Skip to content

Commit

Permalink
fix(projections): include postalnames when retrieving postalinformation
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneD committed Jan 7, 2025
1 parent 01d0f39 commit 7070704
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading;
using System.Threading.Tasks;
using Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector;
using Microsoft.EntityFrameworkCore;

public static class PostalLatestItemExtensions
{
Expand All @@ -14,7 +15,8 @@ public static async Task<PostalLatestItem> FindAndUpdatePostal(this IntegrationC
{
var postalItem = await context
.PostalLatestItems
.FindAsync(postalCode, cancellationToken: ct);
.Include(x=> x.PostalNames)
.SingleOrDefaultAsync(x => x.PostalCode == postalCode, cancellationToken: ct);

if (postalItem == null)
throw DatabaseItemNotFound(postalCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace PostalRegistry.Projections.Legacy.PostalInformation
using System.Threading;
using System.Threading.Tasks;
using Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector;
using Microsoft.EntityFrameworkCore;

public static class PostalInformationExtensions
{
Expand All @@ -15,7 +16,8 @@ public static async Task<PostalInformation> FindAndUpdatePostalInformation(
{
var postalInformation = await context
.PostalInformation
.FindAsync(postalCode, cancellationToken: ct);
.Include(p => p.PostalNames)
.SingleOrDefaultAsync(x => x.PostalCode == postalCode, cancellationToken: ct);

if (postalInformation == null)
throw DatabaseItemNotFound(postalCode);
Expand Down

0 comments on commit 7070704

Please sign in to comment.