1
0
mirror of https://github.com/bitwarden/server synced 2025-12-24 20:23:21 +00: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,38 +5,37 @@ using Bit.Core.Repositories;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace Bit.Infrastructure.EntityFramework.Repositories
namespace Bit.Infrastructure.EntityFramework.Repositories;
public class OrganizationConnectionRepository : Repository<OrganizationConnection, Models.OrganizationConnection, Guid>, IOrganizationConnectionRepository
{
public class OrganizationConnectionRepository : Repository<OrganizationConnection, Models.OrganizationConnection, Guid>, IOrganizationConnectionRepository
public OrganizationConnectionRepository(IServiceScopeFactory serviceScopeFactory,
IMapper mapper)
: base(serviceScopeFactory, mapper, context => context.OrganizationConnections)
{
public OrganizationConnectionRepository(IServiceScopeFactory serviceScopeFactory,
IMapper mapper)
: base(serviceScopeFactory, mapper, context => context.OrganizationConnections)
{
}
}
public async Task<ICollection<OrganizationConnection>> GetByOrganizationIdTypeAsync(Guid organizationId, OrganizationConnectionType type)
public async Task<ICollection<OrganizationConnection>> GetByOrganizationIdTypeAsync(Guid organizationId, OrganizationConnectionType type)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var connections = await dbContext.OrganizationConnections
.Where(oc => oc.OrganizationId == organizationId && oc.Type == type)
.ToListAsync();
return Mapper.Map<List<OrganizationConnection>>(connections);
}
var dbContext = GetDatabaseContext(scope);
var connections = await dbContext.OrganizationConnections
.Where(oc => oc.OrganizationId == organizationId && oc.Type == type)
.ToListAsync();
return Mapper.Map<List<OrganizationConnection>>(connections);
}
}
public async Task<ICollection<OrganizationConnection>> GetEnabledByOrganizationIdTypeAsync(Guid organizationId, OrganizationConnectionType type)
public async Task<ICollection<OrganizationConnection>> GetEnabledByOrganizationIdTypeAsync(Guid organizationId, OrganizationConnectionType type)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var connections = await dbContext.OrganizationConnections
.Where(oc => oc.OrganizationId == organizationId && oc.Type == type && oc.Enabled)
.ToListAsync();
return Mapper.Map<List<OrganizationConnection>>(connections);
}
var dbContext = GetDatabaseContext(scope);
var connections = await dbContext.OrganizationConnections
.Where(oc => oc.OrganizationId == organizationId && oc.Type == type && oc.Enabled)
.ToListAsync();
return Mapper.Map<List<OrganizationConnection>>(connections);
}
}
}