diff --git a/src/Sql/dbo/Stored Procedures/OrganizationIntegrationConfigurationDetails_ReadManyByEventTypeOrganizationIdIntegrationType.sql b/src/Sql/dbo/Stored Procedures/OrganizationIntegrationConfigurationDetails_ReadManyByEventTypeOrganizationIdIntegrationType.sql new file mode 100644 index 0000000000..3240402916 --- /dev/null +++ b/src/Sql/dbo/Stored Procedures/OrganizationIntegrationConfigurationDetails_ReadManyByEventTypeOrganizationIdIntegrationType.sql @@ -0,0 +1,20 @@ +CREATE PROCEDURE [dbo].[OrganizationIntegrationConfigurationDetails_ReadManyByEventTypeOrganizationIdIntegrationType] + @EventType SMALLINT, + @OrganizationId UNIQUEIDENTIFIER, + @IntegrationType SMALLINT +AS +BEGIN + SET NOCOUNT ON + + SELECT + oic.* + FROM + [dbo].[OrganizationIntegrationConfigurationDetailsView] oic + WHERE + oic.[EventType] = @EventType + AND + oic.[OrganizationId] = @OrganizationId + AND + oic.[IntegrationType] = @IntegrationType +END +GO diff --git a/src/Sql/dbo/Stored Procedures/OrganizationIntegrationConfiguration_ReadManyByEventTypeOrganizationIdIntegrationType.sql b/src/Sql/dbo/Stored Procedures/OrganizationIntegrationConfiguration_ReadManyByEventTypeOrganizationIdIntegrationType.sql deleted file mode 100644 index 113aa2e529..0000000000 --- a/src/Sql/dbo/Stored Procedures/OrganizationIntegrationConfiguration_ReadManyByEventTypeOrganizationIdIntegrationType.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE PROCEDURE [dbo].[OrganizationIntegrationConfiguration_ReadManyByEventTypeOrganizationIdIntegrationType] - @EventType SMALLINT, - @OrganizationId UNIQUEIDENTIFIER, - @IntegrationType SMALLINT -AS -BEGIN - SET NOCOUNT ON - - SELECT - oic.* - FROM - [dbo].[OrganizationIntegrationConfigurationView] oic - INNER JOIN - [dbo].[OrganizationIntegration] oi ON oi.[Id] = oic.[OrganizationIntegrationId] - WHERE - oic.[EventType] = @EventType - AND - oi.[OrganizationId] = @OrganizationId - AND - oi.[Type] = @IntegrationType -END -GO diff --git a/src/Sql/dbo/Views/OrganizationIntegrationConfigurationDetailsView.sql b/src/Sql/dbo/Views/OrganizationIntegrationConfigurationDetailsView.sql new file mode 100644 index 0000000000..45609da551 --- /dev/null +++ b/src/Sql/dbo/Views/OrganizationIntegrationConfigurationDetailsView.sql @@ -0,0 +1,13 @@ +CREATE VIEW [dbo].[OrganizationIntegrationConfigurationDetailsView] +AS + SELECT + oi.[OrganizationId], + oi.[Type] AS [IntegrationType], + oic.[EventType], + oic.[Configuration], + oi.[Configuration] AS [IntegrationConfiguration], + oic.[Template] + FROM + [dbo].[OrganizationIntegrationConfiguration] oic + INNER JOIN + [dbo].[OrganizationIntegration] oi ON oi.[Id] = oic.[OrganizationIntegrationId] diff --git a/util/Migrator/DbScripts/2025-03-27_00_OrganizationIntegrationConfigurationDetails.sql b/util/Migrator/DbScripts/2025-03-27_00_OrganizationIntegrationConfigurationDetails.sql new file mode 100644 index 0000000000..233afa7e3e --- /dev/null +++ b/util/Migrator/DbScripts/2025-03-27_00_OrganizationIntegrationConfigurationDetails.sql @@ -0,0 +1,49 @@ +IF EXISTS(SELECT * +FROM sys.views +WHERE [Name] = 'OrganizationIntegrationConfigurationDetailsView') +BEGIN + DROP VIEW [dbo].[OrganizationIntegrationConfigurationDetailsView]; +END +GO + +CREATE VIEW [dbo].[OrganizationIntegrationConfigurationDetailsView] +AS + SELECT + oi.[OrganizationId], + oi.[Type] AS [IntegrationType], + oic.[EventType], + oic.[Configuration], + oi.[Configuration] AS [IntegrationConfiguration], + oic.[Template] + FROM + [dbo].[OrganizationIntegrationConfiguration] oic + INNER JOIN + [dbo].[OrganizationIntegration] oi ON oi.[Id] = oic.[OrganizationIntegrationId] +GO + +IF OBJECT_ID('[dbo].[OrganizationIntegrationConfiguration_ReadManyByEventTypeOrganizationIdIntegrationType]') IS NOT NULL + BEGIN + DROP PROCEDURE [dbo].[OrganizationIntegrationConfiguration_ReadManyByEventTypeOrganizationIdIntegrationType] +END +GO + +CREATE OR ALTER PROCEDURE [dbo].[OrganizationIntegrationConfigurationDetails_ReadManyByEventTypeOrganizationIdIntegrationType] + @EventType SMALLINT, + @OrganizationId UNIQUEIDENTIFIER, + @IntegrationType SMALLINT +AS +BEGIN + SET NOCOUNT ON + + SELECT + oic.* + FROM + [dbo].[OrganizationIntegrationConfigurationDetailsView] oic + WHERE + oic.[EventType] = @EventType + AND + oic.[OrganizationId] = @OrganizationId + AND + oic.[IntegrationType] = @IntegrationType +END +GO