-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AC-1487] Update queries to use [User] table instead of [Organization…
…User] for email address (#3083)
- Loading branch information
1 parent
4f87e4e
commit fe570cb
Showing
3 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
util/Migrator/DbScripts/2023-07-10_00_FixTdeAdminApprovalEmail.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
CREATE OR ALTER PROCEDURE [dbo].[AuthRequest_ReadAdminApprovalsByIds] | ||
@OrganizationId UNIQUEIDENTIFIER, | ||
@Ids AS [dbo].[GuidIdArray] READONLY | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON | ||
|
||
SELECT | ||
ar.*, u.[Email], ou.[Id] AS [OrganizationUserId] | ||
FROM | ||
[dbo].[AuthRequestView] ar | ||
INNER JOIN | ||
[dbo].[OrganizationUser] ou ON ou.[UserId] = ar.[UserId] AND ou.[OrganizationId] = ar.[OrganizationId] | ||
INNER JOIN | ||
[dbo].[User] u ON u.[Id] = ar.[UserId] | ||
WHERE | ||
ar.[OrganizationId] = @OrganizationId | ||
AND | ||
ar.[Type] = 2 -- AdminApproval | ||
AND | ||
ar.[Id] IN (SELECT [Id] FROM @Ids) | ||
END | ||
GO | ||
|
||
CREATE OR ALTER PROCEDURE [dbo].[AuthRequest_ReadPendingByOrganizationId] | ||
@OrganizationId UNIQUEIDENTIFIER | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON | ||
|
||
SELECT | ||
ar.*, u.[Email], ou.[Id] AS [OrganizationUserId] | ||
FROM | ||
[dbo].[AuthRequestView] ar | ||
INNER JOIN | ||
[dbo].[OrganizationUser] ou ON ou.[UserId] = ar.[UserId] AND ou.[OrganizationId] = ar.[OrganizationId] | ||
INNER JOIN | ||
[dbo].[User] u ON u.[Id] = ar.[UserId] | ||
WHERE | ||
ar.[OrganizationId] = @OrganizationId | ||
AND | ||
ar.[ResponseDate] IS NULL | ||
AND | ||
ar.[Type] = 2 -- AdminApproval | ||
END | ||
GO |