mirror of
https://github.com/bitwarden/server.git
synced 2026-01-31 22:23:18 +08:00
[PS-1928] Add BumpAccountRevisionDate methods (#2458)
* Move RevisionDate Bumps to Extension Class * Add Tests against live databases * Run Formatting * Fix Typo * Fix Test Solution Typo * Await ReplaceAsync
This commit is contained in:
@@ -16,6 +16,17 @@ public class ProviderUserRepository :
|
||||
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.ProviderUsers)
|
||||
{ }
|
||||
|
||||
public override async Task DeleteAsync(ProviderUser providerUser)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
{
|
||||
var dbContext = GetDatabaseContext(scope);
|
||||
await dbContext.UserBumpAccountRevisionDateByProviderUserIdAsync(providerUser.Id);
|
||||
await dbContext.SaveChangesAsync();
|
||||
}
|
||||
await base.DeleteAsync(providerUser);
|
||||
}
|
||||
|
||||
public async Task<int> GetCountByProviderAsync(Guid providerId, string email, bool onlyRegisteredUsers)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
@@ -59,7 +70,10 @@ public class ProviderUserRepository :
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
{
|
||||
var dbContext = GetDatabaseContext(scope);
|
||||
await UserBumpAccountRevisionDateByProviderUserIds(providerUserIds.ToArray());
|
||||
foreach (var providerUserId in providerUserIds)
|
||||
{
|
||||
await dbContext.UserBumpAccountRevisionDateByProviderUserIdAsync(providerUserId);
|
||||
}
|
||||
var entities = dbContext.ProviderUsers.Where(pu => providerUserIds.Contains(pu.Id));
|
||||
dbContext.ProviderUsers.RemoveRange(entities);
|
||||
await dbContext.SaveChangesAsync();
|
||||
|
||||
Reference in New Issue
Block a user