1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-05 01:52:49 -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,76 +5,75 @@ using Bit.Core.Repositories;
using Bit.Core.Settings;
using Dapper;
namespace Bit.Infrastructure.Dapper.Repositories
namespace Bit.Infrastructure.Dapper.Repositories;
public class GrantRepository : BaseRepository, IGrantRepository
{
public class GrantRepository : BaseRepository, IGrantRepository
public GrantRepository(GlobalSettings globalSettings)
: this(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
{ }
public GrantRepository(string connectionString, string readOnlyConnectionString)
: base(connectionString, readOnlyConnectionString)
{ }
public async Task<Grant> GetByKeyAsync(string key)
{
public GrantRepository(GlobalSettings globalSettings)
: this(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
{ }
public GrantRepository(string connectionString, string readOnlyConnectionString)
: base(connectionString, readOnlyConnectionString)
{ }
public async Task<Grant> GetByKeyAsync(string key)
using (var connection = new SqlConnection(ConnectionString))
{
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<Grant>(
"[dbo].[Grant_ReadByKey]",
new { Key = key },
commandType: CommandType.StoredProcedure);
var results = await connection.QueryAsync<Grant>(
"[dbo].[Grant_ReadByKey]",
new { Key = key },
commandType: CommandType.StoredProcedure);
return results.SingleOrDefault();
}
return results.SingleOrDefault();
}
}
public async Task<ICollection<Grant>> GetManyAsync(string subjectId, string sessionId,
string clientId, string type)
public async Task<ICollection<Grant>> GetManyAsync(string subjectId, string sessionId,
string clientId, string type)
{
using (var connection = new SqlConnection(ConnectionString))
{
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<Grant>(
"[dbo].[Grant_Read]",
new { SubjectId = subjectId, SessionId = sessionId, ClientId = clientId, Type = type },
commandType: CommandType.StoredProcedure);
var results = await connection.QueryAsync<Grant>(
"[dbo].[Grant_Read]",
new { SubjectId = subjectId, SessionId = sessionId, ClientId = clientId, Type = type },
commandType: CommandType.StoredProcedure);
return results.ToList();
}
return results.ToList();
}
}
public async Task SaveAsync(Grant obj)
public async Task SaveAsync(Grant obj)
{
using (var connection = new SqlConnection(ConnectionString))
{
using (var connection = new SqlConnection(ConnectionString))
{
var results = await connection.ExecuteAsync(
"[dbo].[Grant_Save]",
obj,
commandType: CommandType.StoredProcedure);
}
var results = await connection.ExecuteAsync(
"[dbo].[Grant_Save]",
obj,
commandType: CommandType.StoredProcedure);
}
}
public async Task DeleteByKeyAsync(string key)
public async Task DeleteByKeyAsync(string key)
{
using (var connection = new SqlConnection(ConnectionString))
{
using (var connection = new SqlConnection(ConnectionString))
{
await connection.ExecuteAsync(
"[dbo].[Grant_DeleteByKey]",
new { Key = key },
commandType: CommandType.StoredProcedure);
}
await connection.ExecuteAsync(
"[dbo].[Grant_DeleteByKey]",
new { Key = key },
commandType: CommandType.StoredProcedure);
}
}
public async Task DeleteManyAsync(string subjectId, string sessionId, string clientId, string type)
public async Task DeleteManyAsync(string subjectId, string sessionId, string clientId, string type)
{
using (var connection = new SqlConnection(ConnectionString))
{
using (var connection = new SqlConnection(ConnectionString))
{
await connection.ExecuteAsync(
"[dbo].[Grant_Delete]",
new { SubjectId = subjectId, SessionId = sessionId, ClientId = clientId, Type = type },
commandType: CommandType.StoredProcedure);
}
await connection.ExecuteAsync(
"[dbo].[Grant_Delete]",
new { SubjectId = subjectId, SessionId = sessionId, ClientId = clientId, Type = type },
commandType: CommandType.StoredProcedure);
}
}
}