mirror of
https://github.com/bitwarden/server.git
synced 2025-06-25 13:18:48 -05:00
36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using System.Data;
|
|
using Bit.Core.Dirt.Reports.Entities;
|
|
using Bit.Core.Dirt.Reports.Repositories;
|
|
using Bit.Core.Settings;
|
|
using Bit.Infrastructure.Dapper.Repositories;
|
|
using Dapper;
|
|
using Microsoft.Data.SqlClient;
|
|
|
|
namespace Bit.Infrastructure.Dapper.Dirt;
|
|
|
|
public class OrganizationReportRepository : Repository<OrganizationReport, Guid>, IOrganizationReportRepository
|
|
{
|
|
public OrganizationReportRepository(GlobalSettings globalSettings)
|
|
: this(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
|
|
{
|
|
}
|
|
|
|
public OrganizationReportRepository(string connectionString, string readOnlyConnectionString)
|
|
: base(connectionString, readOnlyConnectionString)
|
|
{
|
|
}
|
|
|
|
public async Task<ICollection<OrganizationReport>> GetByOrganizationIdAsync(Guid organizationId)
|
|
{
|
|
using (var connection = new SqlConnection(ReadOnlyConnectionString))
|
|
{
|
|
var results = await connection.QueryAsync<OrganizationReport>(
|
|
$"[{Schema}].[RiskInsightReport_ReadByOrganizationId]",
|
|
new { OrganizationId = organizationId },
|
|
commandType: CommandType.StoredProcedure);
|
|
|
|
return results.ToList();
|
|
}
|
|
}
|
|
}
|