1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-05 01:52:49 -05:00

Split out repositories to Infrastructure.Dapper / EntityFramework (#1759)

This commit is contained in:
Oscar Hinton
2022-01-11 10:40:51 +01:00
committed by GitHub
parent e2c6fc81f4
commit e4a10aae27
536 changed files with 1629 additions and 1589 deletions

View File

@ -0,0 +1,44 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using Bit.Core.Repositories;
using Microsoft.Extensions.DependencyInjection;
namespace Bit.Infrastructure.EntityFramework.Repositories
{
public class MaintenanceRepository : BaseEntityFrameworkRepository, IMaintenanceRepository
{
public MaintenanceRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
: base(serviceScopeFactory, mapper)
{ }
public async Task DeleteExpiredGrantsAsync()
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var query = from g in dbContext.Grants
where g.ExpirationDate < DateTime.UtcNow
select g;
dbContext.RemoveRange(query);
await dbContext.SaveChangesAsync();
}
}
public Task DisableCipherAutoStatsAsync()
{
return Task.CompletedTask;
}
public Task RebuildIndexesAsync()
{
return Task.CompletedTask;
}
public Task UpdateStatisticsAsync()
{
return Task.CompletedTask;
}
}
}