mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 09:32:48 -05:00
Revert filescoped (#2227)
* Revert "Add git blame entry (#2226)" This reverts commit239286737d
. * Revert "Turn on file scoped namespaces (#2225)" This reverts commit34fb4cca2a
.
This commit is contained in:
@ -5,46 +5,47 @@ using Bit.Infrastructure.EntityFramework.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Repositories;
|
||||
|
||||
public class TransactionRepository : Repository<Core.Entities.Transaction, Transaction, Guid>, ITransactionRepository
|
||||
namespace Bit.Infrastructure.EntityFramework.Repositories
|
||||
{
|
||||
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 class TransactionRepository : Repository<Core.Entities.Transaction, Transaction, Guid>, ITransactionRepository
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
public TransactionRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
|
||||
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Transactions)
|
||||
{ }
|
||||
|
||||
public async Task<Core.Entities.Transaction> GetByGatewayIdAsync(GatewayType gatewayType, string gatewayId)
|
||||
{
|
||||
var dbContext = GetDatabaseContext(scope);
|
||||
var results = await dbContext.Transactions
|
||||
.FirstOrDefaultAsync(t => (t.GatewayId == gatewayId && t.Gateway == gatewayType));
|
||||
return Mapper.Map<Core.Entities.Transaction>(results);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<Core.Entities.Transaction>> GetManyByOrganizationIdAsync(Guid organizationId)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
public async Task<ICollection<Core.Entities.Transaction>> GetManyByOrganizationIdAsync(Guid organizationId)
|
||||
{
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<Core.Entities.Transaction>> GetManyByUserIdAsync(Guid userId)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
public async Task<ICollection<Core.Entities.Transaction>> GetManyByUserIdAsync(Guid userId)
|
||||
{
|
||||
var dbContext = GetDatabaseContext(scope);
|
||||
var results = await dbContext.Transactions
|
||||
.Where(t => (t.UserId == userId))
|
||||
.ToListAsync();
|
||||
return Mapper.Map<List<Core.Entities.Transaction>>(results);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user