fix(transport): notification-list Overwrite replaces recipients instead of appending (TRN-1, WP2 task 2.1)

GetListByNameAsync now eager-loads Recipients, so the importer's Overwrite
Clear() removes the target's rows before the bundle's are re-added. Fixed in
the repository method (decision 2.1) so every caller gets the recipients.
Regression: target {A,B} + bundle {A,C} -> {A,C}, stable on re-import.
This commit is contained in:
Joseph Doherty
2026-12-03 09:38:41 -05:00
parent f7e4f5b4ed
commit f42c17d2ce
2 changed files with 180 additions and 1 deletions
@@ -30,7 +30,13 @@ public class NotificationRepository : INotificationRepository
/// <inheritdoc />
public async Task<NotificationList?> GetListByNameAsync(string name, CancellationToken cancellationToken = default)
=> await _context.Set<NotificationList>().FirstOrDefaultAsync(l => l.Name == name, cancellationToken);
// Eager-load Recipients (TRN-1): the Transport importer's Overwrite clears and
// re-adds the recipient collection. Without the Include the Clear() ran on an
// unloaded collection, deleted nothing, and the bundle's recipients were appended
// to the target's — duplicates plus recipients the source had removed.
=> await _context.Set<NotificationList>()
.Include(n => n.Recipients)
.FirstOrDefaultAsync(l => l.Name == name, cancellationToken);
/// <inheritdoc />
public async Task AddNotificationListAsync(NotificationList list, CancellationToken cancellationToken = default)