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

Run formatting (#2230)

This commit is contained in:
Justin Baur
2022-08-29 16:06:55 -04:00
committed by GitHub
parent 9b7aef0763
commit 7f5f010e1e
1205 changed files with 73813 additions and 75022 deletions

View File

@ -4,43 +4,42 @@ using Bit.Infrastructure.EntityFramework.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace Bit.Infrastructure.EntityFramework.Repositories
namespace Bit.Infrastructure.EntityFramework.Repositories;
public class SendRepository : Repository<Core.Entities.Send, Send, Guid>, ISendRepository
{
public class SendRepository : Repository<Core.Entities.Send, Send, Guid>, ISendRepository
public SendRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Sends)
{ }
public override async Task<Core.Entities.Send> CreateAsync(Core.Entities.Send send)
{
public SendRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Sends)
{ }
public override async Task<Core.Entities.Send> CreateAsync(Core.Entities.Send send)
send = await base.CreateAsync(send);
if (send.UserId.HasValue)
{
send = await base.CreateAsync(send);
if (send.UserId.HasValue)
{
await UserUpdateStorage(send.UserId.Value);
await UserBumpAccountRevisionDate(send.UserId.Value);
}
return send;
await UserUpdateStorage(send.UserId.Value);
await UserBumpAccountRevisionDate(send.UserId.Value);
}
return send;
}
public async Task<ICollection<Core.Entities.Send>> GetManyByDeletionDateAsync(DateTime deletionDateBefore)
public async Task<ICollection<Core.Entities.Send>> GetManyByDeletionDateAsync(DateTime deletionDateBefore)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var results = await dbContext.Sends.Where(s => s.DeletionDate < deletionDateBefore).ToListAsync();
return Mapper.Map<List<Core.Entities.Send>>(results);
}
var dbContext = GetDatabaseContext(scope);
var results = await dbContext.Sends.Where(s => s.DeletionDate < deletionDateBefore).ToListAsync();
return Mapper.Map<List<Core.Entities.Send>>(results);
}
}
public async Task<ICollection<Core.Entities.Send>> GetManyByUserIdAsync(Guid userId)
public async Task<ICollection<Core.Entities.Send>> GetManyByUserIdAsync(Guid userId)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var results = await dbContext.Sends.Where(s => s.UserId == userId).ToListAsync();
return Mapper.Map<List<Core.Entities.Send>>(results);
}
var dbContext = GetDatabaseContext(scope);
var results = await dbContext.Sends.Where(s => s.UserId == userId).ToListAsync();
return Mapper.Map<List<Core.Entities.Send>>(results);
}
}
}