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:
+7
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user