1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

[SG-927] Pull the user's selected avatar color from the state store and display on Emergency Contacts page (#2582)

* work: backend changes

* fix: lets not mix up Grantor and Grantee

* work: update view
This commit is contained in:
Brandon Maharaj
2023-01-20 13:11:16 -05:00
committed by GitHub
parent 7b4c9b0e59
commit 862ce01bf4
4 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,37 @@
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE OR ALTER VIEW [dbo].[EmergencyAccessDetailsView]
AS
SELECT
EA.*,
GranteeU.[Name] GranteeName,
ISNULL(GranteeU.[Email], EA.[Email]) GranteeEmail,
GranteeU.[AvatarColor] GranteeAvatarColor,
GrantorU.[Name] GrantorName,
GrantorU.[Email] GrantorEmail,
GrantorU.[AvatarColor] GrantorAvatarColor
FROM
[dbo].[EmergencyAccess] EA
LEFT JOIN
[dbo].[User] GranteeU ON GranteeU.[Id] = EA.[GranteeId]
LEFT JOIN
[dbo].[User] GrantorU ON GrantorU.[Id] = EA.[GrantorId]
GO
CREATE OR ALTER PROCEDURE [dbo].[EmergencyAccessDetails_ReadByGrantorId]
@GrantorId UNIQUEIDENTIFIER
AS
BEGIN
SET NOCOUNT ON
SELECT
*
FROM
[dbo].[EmergencyAccessDetailsView]
WHERE
[GrantorId] = @GrantorId
END
GO