diff --git a/src/Infrastructure.Dapper/Dirt/OrganizationApplicationRepository.cs b/src/Infrastructure.Dapper/Dirt/OrganizationApplicationRepository.cs index 46a126de2a..9f1d4d1172 100644 --- a/src/Infrastructure.Dapper/Dirt/OrganizationApplicationRepository.cs +++ b/src/Infrastructure.Dapper/Dirt/OrganizationApplicationRepository.cs @@ -25,7 +25,7 @@ public class OrganizationApplicationRepository : Repository( - $"[{Schema}].[RiskInsightCriticalApplication_ReadByOrganizationId]", + $"[{Schema}].[OrganizationApplication_ReadByOrganizationId]", new { OrganizationId = organizationId }, commandType: CommandType.StoredProcedure); diff --git a/src/Infrastructure.Dapper/Dirt/OrganizationReportRepository.cs b/src/Infrastructure.Dapper/Dirt/OrganizationReportRepository.cs index 923d1767e3..88478c31ae 100644 --- a/src/Infrastructure.Dapper/Dirt/OrganizationReportRepository.cs +++ b/src/Infrastructure.Dapper/Dirt/OrganizationReportRepository.cs @@ -25,7 +25,7 @@ public class OrganizationReportRepository : Repository using (var connection = new SqlConnection(ReadOnlyConnectionString)) { var results = await connection.QueryAsync( - $"[{Schema}].[RiskInsightReport_ReadByOrganizationId]", + $"[{Schema}].[OrganizationReport_ReadByOrganizationId]", new { OrganizationId = organizationId }, commandType: CommandType.StoredProcedure); diff --git a/src/Sql/dbo/Dirt/Tables/OrganizationReport.sql b/src/Sql/dbo/Dirt/Tables/OrganizationReport.sql index 1737564a34..f4aaef0f21 100644 --- a/src/Sql/dbo/Dirt/Tables/OrganizationReport.sql +++ b/src/Sql/dbo/Dirt/Tables/OrganizationReport.sql @@ -13,3 +13,7 @@ GO CREATE NONCLUSTERED INDEX [IX_OrganizationReport_OrganizationId] ON [dbo].[OrganizationReport]([OrganizationId] ASC); GO + +CREATE NONCLUSTERED INDEX [IX_OrganizationReport_OrganizationId_Date] + ON [dbo].[OrganizationReport]([OrganizationId] ASC, [Date] DESC); +GO \ No newline at end of file