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

Revert filescoped (#2227)

* Revert "Add git blame entry (#2226)"

This reverts commit 239286737d.

* Revert "Turn on file scoped namespaces (#2225)"

This reverts commit 34fb4cca2a.
This commit is contained in:
Justin Baur
2022-08-29 15:53:48 -04:00
committed by GitHub
parent 239286737d
commit bae03feffe
1208 changed files with 74317 additions and 73126 deletions

View File

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