1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 09:32:48 -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

@ -5,47 +5,46 @@ using Bit.Infrastructure.EntityFramework.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace Bit.Infrastructure.EntityFramework.Repositories
namespace Bit.Infrastructure.EntityFramework.Repositories;
public class TransactionRepository : Repository<Core.Entities.Transaction, Transaction, Guid>, ITransactionRepository
{
public class TransactionRepository : Repository<Core.Entities.Transaction, Transaction, Guid>, ITransactionRepository
public TransactionRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Transactions)
{ }
public async Task<Core.Entities.Transaction> GetByGatewayIdAsync(GatewayType gatewayType, string gatewayId)
{
public TransactionRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Transactions)
{ }
public async Task<Core.Entities.Transaction> GetByGatewayIdAsync(GatewayType gatewayType, string gatewayId)
using (var scope = ServiceScopeFactory.CreateScope())
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var results = await dbContext.Transactions
.FirstOrDefaultAsync(t => (t.GatewayId == gatewayId && t.Gateway == gatewayType));
return Mapper.Map<Core.Entities.Transaction>(results);
}
var dbContext = GetDatabaseContext(scope);
var results = await dbContext.Transactions
.FirstOrDefaultAsync(t => (t.GatewayId == gatewayId && t.Gateway == gatewayType));
return Mapper.Map<Core.Entities.Transaction>(results);
}
}
public async Task<ICollection<Core.Entities.Transaction>> GetManyByOrganizationIdAsync(Guid organizationId)
public async Task<ICollection<Core.Entities.Transaction>> GetManyByOrganizationIdAsync(Guid organizationId)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var results = await dbContext.Transactions
.Where(t => (t.OrganizationId == organizationId && !t.UserId.HasValue))
.ToListAsync();
return Mapper.Map<List<Core.Entities.Transaction>>(results);
}
var dbContext = GetDatabaseContext(scope);
var results = await dbContext.Transactions
.Where(t => (t.OrganizationId == organizationId && !t.UserId.HasValue))
.ToListAsync();
return Mapper.Map<List<Core.Entities.Transaction>>(results);
}
}
public async Task<ICollection<Core.Entities.Transaction>> GetManyByUserIdAsync(Guid userId)
public async Task<ICollection<Core.Entities.Transaction>> GetManyByUserIdAsync(Guid userId)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var results = await dbContext.Transactions
.Where(t => (t.UserId == userId))
.ToListAsync();
return Mapper.Map<List<Core.Entities.Transaction>>(results);
}
var dbContext = GetDatabaseContext(scope);
var results = await dbContext.Transactions
.Where(t => (t.UserId == userId))
.ToListAsync();
return Mapper.Map<List<Core.Entities.Transaction>>(results);
}
}
}