1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-17 23:50:58 -05:00

[PM-336] Nullable Platform & Unowned Services (#5646)

* Nullable Platform & Unowned Services

* Fix build errors

* Format
This commit is contained in:
Justin Baur
2025-04-15 12:56:58 -04:00
committed by GitHub
parent 84a984a9e6
commit 2242a70e50
22 changed files with 141 additions and 84 deletions

View File

@ -513,15 +513,21 @@ public class CollectionRepository : Repository<Core.Entities.Collection, Collect
}
}
public async Task ReplaceAsync(Core.Entities.Collection collection, IEnumerable<CollectionAccessSelection> groups,
IEnumerable<CollectionAccessSelection> users)
public async Task ReplaceAsync(Core.Entities.Collection collection, IEnumerable<CollectionAccessSelection>? groups,
IEnumerable<CollectionAccessSelection>? users)
{
await UpsertAsync(collection);
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
await ReplaceCollectionGroupsAsync(dbContext, collection, groups);
await ReplaceCollectionUsersAsync(dbContext, collection, users);
if (groups != null)
{
await ReplaceCollectionGroupsAsync(dbContext, collection, groups);
}
if (users != null)
{
await ReplaceCollectionUsersAsync(dbContext, collection, users);
}
await dbContext.UserBumpAccountRevisionDateByCollectionIdAsync(collection.Id, collection.OrganizationId);
await dbContext.SaveChangesAsync();
}