1
0
mirror of https://github.com/bitwarden/server synced 2025-12-26 05:03:18 +00:00

Turn on file scoped namespaces (#2225)

This commit is contained in:
Justin Baur
2022-08-29 14:53:16 -04:00
committed by GitHub
parent 7c4521e0b4
commit 34fb4cca2a
1206 changed files with 73816 additions and 75022 deletions

View File

@@ -6,92 +6,91 @@ using Bit.Core.Repositories;
using Bit.Core.Settings;
using Dapper;
namespace Bit.Infrastructure.Dapper.Repositories
namespace Bit.Infrastructure.Dapper.Repositories;
public class EmergencyAccessRepository : Repository<EmergencyAccess, Guid>, IEmergencyAccessRepository
{
public class EmergencyAccessRepository : Repository<EmergencyAccess, Guid>, IEmergencyAccessRepository
public EmergencyAccessRepository(GlobalSettings globalSettings)
: this(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
{ }
public EmergencyAccessRepository(string connectionString, string readOnlyConnectionString)
: base(connectionString, readOnlyConnectionString)
{ }
public async Task<int> GetCountByGrantorIdEmailAsync(Guid grantorId, string email, bool onlyRegisteredUsers)
{
public EmergencyAccessRepository(GlobalSettings globalSettings)
: this(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
{ }
public EmergencyAccessRepository(string connectionString, string readOnlyConnectionString)
: base(connectionString, readOnlyConnectionString)
{ }
public async Task<int> GetCountByGrantorIdEmailAsync(Guid grantorId, string email, bool onlyRegisteredUsers)
using (var connection = new SqlConnection(ConnectionString))
{
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.ExecuteScalarAsync<int>(
"[dbo].[EmergencyAccess_ReadCountByGrantorIdEmail]",
new { GrantorId = grantorId, Email = email, OnlyUsers = onlyRegisteredUsers },
commandType: CommandType.StoredProcedure);
var results = await connection.ExecuteScalarAsync<int>(
"[dbo].[EmergencyAccess_ReadCountByGrantorIdEmail]",
new { GrantorId = grantorId, Email = email, OnlyUsers = onlyRegisteredUsers },
commandType: CommandType.StoredProcedure);
return results;
}
return results;
}
}
public async Task<ICollection<EmergencyAccessDetails>> GetManyDetailsByGrantorIdAsync(Guid grantorId)
public async Task<ICollection<EmergencyAccessDetails>> GetManyDetailsByGrantorIdAsync(Guid grantorId)
{
using (var connection = new SqlConnection(ConnectionString))
{
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<EmergencyAccessDetails>(
"[dbo].[EmergencyAccessDetails_ReadByGrantorId]",
new { GrantorId = grantorId },
commandType: CommandType.StoredProcedure);
var results = await connection.QueryAsync<EmergencyAccessDetails>(
"[dbo].[EmergencyAccessDetails_ReadByGrantorId]",
new { GrantorId = grantorId },
commandType: CommandType.StoredProcedure);
return results.ToList();
}
return results.ToList();
}
}
public async Task<ICollection<EmergencyAccessDetails>> GetManyDetailsByGranteeIdAsync(Guid granteeId)
public async Task<ICollection<EmergencyAccessDetails>> GetManyDetailsByGranteeIdAsync(Guid granteeId)
{
using (var connection = new SqlConnection(ConnectionString))
{
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<EmergencyAccessDetails>(
"[dbo].[EmergencyAccessDetails_ReadByGranteeId]",
new { GranteeId = granteeId },
commandType: CommandType.StoredProcedure);
var results = await connection.QueryAsync<EmergencyAccessDetails>(
"[dbo].[EmergencyAccessDetails_ReadByGranteeId]",
new { GranteeId = granteeId },
commandType: CommandType.StoredProcedure);
return results.ToList();
}
return results.ToList();
}
}
public async Task<EmergencyAccessDetails> GetDetailsByIdGrantorIdAsync(Guid id, Guid grantorId)
public async Task<EmergencyAccessDetails> GetDetailsByIdGrantorIdAsync(Guid id, Guid grantorId)
{
using (var connection = new SqlConnection(ConnectionString))
{
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<EmergencyAccessDetails>(
"[dbo].[EmergencyAccessDetails_ReadByIdGrantorId]",
new { Id = id, GrantorId = grantorId },
commandType: CommandType.StoredProcedure);
var results = await connection.QueryAsync<EmergencyAccessDetails>(
"[dbo].[EmergencyAccessDetails_ReadByIdGrantorId]",
new { Id = id, GrantorId = grantorId },
commandType: CommandType.StoredProcedure);
return results.FirstOrDefault();
}
return results.FirstOrDefault();
}
}
public async Task<ICollection<EmergencyAccessNotify>> GetManyToNotifyAsync()
public async Task<ICollection<EmergencyAccessNotify>> GetManyToNotifyAsync()
{
using (var connection = new SqlConnection(ConnectionString))
{
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<EmergencyAccessNotify>(
"[dbo].[EmergencyAccess_ReadToNotify]",
commandType: CommandType.StoredProcedure);
var results = await connection.QueryAsync<EmergencyAccessNotify>(
"[dbo].[EmergencyAccess_ReadToNotify]",
commandType: CommandType.StoredProcedure);
return results.ToList();
}
return results.ToList();
}
}
public async Task<ICollection<EmergencyAccessDetails>> GetExpiredRecoveriesAsync()
public async Task<ICollection<EmergencyAccessDetails>> GetExpiredRecoveriesAsync()
{
using (var connection = new SqlConnection(ConnectionString))
{
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<EmergencyAccessDetails>(
"[dbo].[EmergencyAccessDetails_ReadExpiredRecoveries]",
commandType: CommandType.StoredProcedure);
var results = await connection.QueryAsync<EmergencyAccessDetails>(
"[dbo].[EmergencyAccessDetails_ReadExpiredRecoveries]",
commandType: CommandType.StoredProcedure);
return results.ToList();
}
return results.ToList();
}
}
}