fix(ui): apply site scope and the history status filter in the server query, before paging (UI-7, UI-9, UI-10, WP1 task 1.7)
UI-7: Site Calls and the Notification report sent an unscoped query and dropped other sites' rows client-side after paging - Site Calls pages went short (Next disabled, own rows hidden), Notifications showed other sites' counts and empty pages. New additive SourceSitesFilter on SiteCallQueryRequest / NotificationOutboxQueryRequest (+ SourceSites / SourceSiteIds on the repository filters; OPENJSON IN-list in the SiteCalls keyset SQL, Contains in EF) carries the permitted identifiers; an empty set matches nothing. Next is gated on the server page size. UI-9: Secured Writes history paged over every status and filtered terminal rows client-side. Additive ListSecuredWritesCommand.Statuses reaches the repository query and count. UI-10: Notification KPIs per-site table is narrowed to the caller's sites (SiteScopeService.Resolve on the principal). Tests: MSSQL mixed-site keyset/offset paging + count for both repos and the secured-write status set; handler forwards Statuses; UI pages send the permitted set (scoped) / none (system-wide); history requests the terminal statuses; KPI per-site rows narrowed.
This commit is contained in:
+12
@@ -58,6 +58,7 @@ public class SecuredWriteRepository : ISecuredWriteRepository
|
||||
int skip,
|
||||
int take,
|
||||
IReadOnlyCollection<string>? permittedSiteIds = null,
|
||||
IReadOnlyCollection<string>? statuses = null,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
IQueryable<PendingSecuredWrite> query = _context.Set<PendingSecuredWrite>()
|
||||
@@ -78,6 +79,11 @@ public class SecuredWriteRepository : ISecuredWriteRepository
|
||||
query = query.Where(p => permittedSiteIds.Contains(p.SiteId));
|
||||
}
|
||||
|
||||
if (statuses is not null)
|
||||
{
|
||||
query = query.Where(p => statuses.Contains(p.Status));
|
||||
}
|
||||
|
||||
return await query
|
||||
.OrderByDescending(p => p.SubmittedAtUtc)
|
||||
.ThenByDescending(p => p.Id)
|
||||
@@ -166,6 +172,7 @@ WHERE Id = {id}
|
||||
string? status,
|
||||
string? siteId,
|
||||
IReadOnlyCollection<string>? permittedSiteIds = null,
|
||||
IReadOnlyCollection<string>? statuses = null,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
IQueryable<PendingSecuredWrite> query = _context.Set<PendingSecuredWrite>()
|
||||
@@ -186,6 +193,11 @@ WHERE Id = {id}
|
||||
query = query.Where(p => permittedSiteIds.Contains(p.SiteId));
|
||||
}
|
||||
|
||||
if (statuses is not null)
|
||||
{
|
||||
query = query.Where(p => statuses.Contains(p.Status));
|
||||
}
|
||||
|
||||
return await query.CountAsync(ct);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user