feat(notification-outbox): additive NotificationId query filter for ?correlationId= deep links
Claude-Session: https://claude.ai/code/session_01NcMG6xXdsJbmD2wYAgkK29
This commit is contained in:
+7
-1
@@ -6,6 +6,11 @@ namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.Notification;
|
||||
/// Outbox UI -> Central: paginated, filtered query over the notification outbox.
|
||||
/// All filter fields are optional; <see cref="StuckOnly"/> restricts results to stuck notifications.
|
||||
/// </summary>
|
||||
/// <param name="NotificationIdFilter">
|
||||
/// Exact match on a single notification — the <c>?correlationId=</c> deep link from the
|
||||
/// Flow Debugger / Audit Log. Additive; <c>null</c> means "no filter" (legacy senders
|
||||
/// compile unchanged).
|
||||
/// </param>
|
||||
public record NotificationOutboxQueryRequest(
|
||||
string CorrelationId,
|
||||
string? StatusFilter,
|
||||
@@ -18,7 +23,8 @@ public record NotificationOutboxQueryRequest(
|
||||
DateTimeOffset? To,
|
||||
int PageNumber,
|
||||
int PageSize,
|
||||
string? SourceNodeFilter = null);
|
||||
string? SourceNodeFilter = null,
|
||||
string? NotificationIdFilter = null);
|
||||
|
||||
/// <summary>
|
||||
/// A single notification row summarised for outbox UI display.
|
||||
|
||||
@@ -23,6 +23,10 @@ namespace ZB.MOM.WW.ScadaBridge.Commons.Types.Notifications;
|
||||
/// <c>"central-a"</c>, <c>"site-plant-a-node-a"</c>). Exact match; <c>null</c>
|
||||
/// means "do not constrain".
|
||||
/// </param>
|
||||
/// <param name="NotificationId">
|
||||
/// Exact match on a single <c>NotificationId</c> — the <c>?correlationId=</c> deep link
|
||||
/// from the Flow Debugger / Audit Log. <c>null</c> means "do not constrain".
|
||||
/// </param>
|
||||
public record NotificationOutboxFilter(
|
||||
NotificationStatus? Status = null,
|
||||
NotificationType? Type = null,
|
||||
@@ -33,4 +37,5 @@ public record NotificationOutboxFilter(
|
||||
DateTimeOffset? StuckCutoff = null,
|
||||
DateTimeOffset? From = null,
|
||||
DateTimeOffset? To = null,
|
||||
string? SourceNode = null);
|
||||
string? SourceNode = null,
|
||||
string? NotificationId = null);
|
||||
|
||||
+6
@@ -280,6 +280,12 @@ VALUES
|
||||
query = query.Where(n => n.Type == type);
|
||||
}
|
||||
|
||||
// Exact match on one notification — the ?correlationId= deep link.
|
||||
if (!string.IsNullOrEmpty(filter.NotificationId))
|
||||
{
|
||||
query = query.Where(n => n.NotificationId == filter.NotificationId);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(filter.SourceSiteId))
|
||||
{
|
||||
query = query.Where(n => n.SourceSiteId == filter.SourceSiteId);
|
||||
|
||||
@@ -940,7 +940,8 @@ public class NotificationOutboxActor : ReceiveActor, IWithTimers
|
||||
StuckCutoff: request.StuckOnly ? StuckCutoff(now) : null,
|
||||
From: request.From,
|
||||
To: request.To,
|
||||
SourceNode: request.SourceNodeFilter);
|
||||
SourceNode: request.SourceNodeFilter,
|
||||
NotificationId: request.NotificationIdFilter);
|
||||
|
||||
using var scope = _serviceProvider.CreateScope();
|
||||
var repository = scope.ServiceProvider.GetRequiredService<INotificationOutboxRepository>();
|
||||
|
||||
Reference in New Issue
Block a user