From 6dac7047088ef997e524c7aa14297e2cfd1c1b97 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 20 May 2017 08:53:24 -0400 Subject: [PATCH] sproc fixes --- .../Stored Procedures/Collection_CreateWithGroups.sql | 6 +++--- .../dbo/Stored Procedures/Collection_DeleteById.sql | 6 ++++++ src/Sql/dbo/Stored Procedures/User_DeleteById.sql | 10 ++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Sql/dbo/Stored Procedures/Collection_CreateWithGroups.sql b/src/Sql/dbo/Stored Procedures/Collection_CreateWithGroups.sql index fcba6e24f..107a8422a 100644 --- a/src/Sql/dbo/Stored Procedures/Collection_CreateWithGroups.sql +++ b/src/Sql/dbo/Stored Procedures/Collection_CreateWithGroups.sql @@ -4,7 +4,7 @@ @Name VARCHAR(MAX), @CreationDate DATETIME2(7), @RevisionDate DATETIME2(7), - @GroupIds AS [dbo].[GuidIdArray] READONLY + @Groups AS [dbo].[SelectionReadOnlyArray] READONLY AS BEGIN SET NOCOUNT ON @@ -28,9 +28,9 @@ BEGIN SELECT @Id, [Id], - 0 + [ReadOnly] FROM - @GroupIds + @Groups WHERE [Id] IN (SELECT [Id] FROM [AvailableGroupsCTE]) END \ No newline at end of file diff --git a/src/Sql/dbo/Stored Procedures/Collection_DeleteById.sql b/src/Sql/dbo/Stored Procedures/Collection_DeleteById.sql index 50643998e..e2e717237 100644 --- a/src/Sql/dbo/Stored Procedures/Collection_DeleteById.sql +++ b/src/Sql/dbo/Stored Procedures/Collection_DeleteById.sql @@ -4,6 +4,12 @@ AS BEGIN SET NOCOUNT ON + DELETE + FROM + [dbo].[CollectionGroup] + WHERE + [CollectionId] = @Id + DELETE FROM [dbo].[Collection] diff --git a/src/Sql/dbo/Stored Procedures/User_DeleteById.sql b/src/Sql/dbo/Stored Procedures/User_DeleteById.sql index ace7e67cb..36cc209b2 100644 --- a/src/Sql/dbo/Stored Procedures/User_DeleteById.sql +++ b/src/Sql/dbo/Stored Procedures/User_DeleteById.sql @@ -48,6 +48,16 @@ BEGIN WHERE OU.[UserId] = @Id + -- Delete group users + DELETE + GU + FROM + [dbo].[GroupUser] GU + INNER JOIN + [dbo].[OrganizationUser] OU ON OU.[Id] = GU.[OrganizationUserId] + WHERE + OU.[UserId] = @Id + -- Delete organization users DELETE FROM