feat(notification-outbox): additive NotificationId query filter for ?correlationId= deep links

Claude-Session: https://claude.ai/code/session_01NcMG6xXdsJbmD2wYAgkK29
This commit is contained in:
Joseph Doherty
2026-09-06 10:59:49 -04:00
parent 7e3e809a70
commit 5497ffd181
6 changed files with 83 additions and 3 deletions
@@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using ZB.MOM.WW.ScadaBridge.Commons.Entities.Notifications;
using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
using ZB.MOM.WW.ScadaBridge.Commons.Types.Notifications;
using ZB.MOM.WW.ScadaBridge.ConfigurationDatabase;
using ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Repositories;
using ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Tests.Migrations;
@@ -101,6 +102,33 @@ public class NotificationOutboxRepositoryIntegrationTests : IClassFixture<MsSqlM
Assert.Equal(1, count);
}
[SkippableFact]
public async Task QueryAsync_NotificationIdFilter_ReturnsExactlyThatRow()
{
Skip.IfNot(_fixture.Available, _fixture.SkipReason);
// Flow Debugger / Audit Log ?correlationId= deep link: an exact match on one
// NotificationId must return that single row and count it alone.
var wantedId = Guid.NewGuid().ToString();
var otherId = Guid.NewGuid().ToString();
await using (var context = CreateContext())
{
var repo = new NotificationOutboxRepository(context);
await repo.InsertIfNotExistsAsync(MakeNotification(wantedId, subject: "Wanted"));
await repo.InsertIfNotExistsAsync(MakeNotification(otherId, subject: "Other"));
}
await using var queryContext = CreateContext();
var queryRepo = new NotificationOutboxRepository(queryContext);
var (rows, totalCount) = await queryRepo.QueryAsync(
new NotificationOutboxFilter(NotificationId: wantedId), pageNumber: 1, pageSize: 50);
Assert.Equal(1, totalCount);
var row = Assert.Single(rows);
Assert.Equal(wantedId, row.NotificationId);
Assert.Equal("Wanted", row.Subject);
}
// --- helpers ------------------------------------------------------------
private ScadaBridgeDbContext CreateContext()