From 5f2a5e000c48069af9264bc4dd6db646f790ce8f Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Thu, 25 Jan 2024 18:58:36 +0000 Subject: [PATCH] Add Auth0ID to all user responses --- Controllers/Case/Case.cs | 18 ++++++++++++------ Controllers/Case/Export.cs | 12 ++++++++---- Controllers/Case/Shared/ContemporaneousNote.cs | 1 + Controllers/Case/Shared/Tab.cs | 3 +++ 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Controllers/Case/Case.cs b/Controllers/Case/Case.cs index 1d186c4..70bbfc6 100644 --- a/Controllers/Case/Case.cs +++ b/Controllers/Case/Case.cs @@ -63,7 +63,8 @@ public CaseController(DatabaseContext dbContext, SqidsEncoder sqids) DisplayName = c.DisplayName, SIO = c.Users.Where(cu => cu.IsSIO).Select(cu => new API.User { - Id = _sqids.Encode(cu.User.Id), JobTitle = cu.User.JobTitle, DisplayName = cu.User.DisplayName, + Id = _sqids.Encode(cu.User.Id), Auth0Id = cu.User.Auth0Id, + JobTitle = cu.User.JobTitle, DisplayName = cu.User.DisplayName, GivenName = cu.User.GivenName, LastName = cu.User.LastName, EmailAddress = cu.User.EmailAddress, ProfilePicture = cu.User.ProfilePicture, @@ -76,7 +77,8 @@ public CaseController(DatabaseContext dbContext, SqidsEncoder sqids) Status = c.Status, Users = c.Users.Select(cu => new API.User { - Id = _sqids.Encode(cu.User.Id), JobTitle = cu.User.JobTitle, DisplayName = cu.User.DisplayName, + Id = _sqids.Encode(cu.User.Id), Auth0Id = cu.User.Auth0Id, + JobTitle = cu.User.JobTitle, DisplayName = cu.User.DisplayName, GivenName = cu.User.GivenName, LastName = cu.User.LastName, EmailAddress = cu.User.EmailAddress, ProfilePicture = cu.User.ProfilePicture, Organization = new API.Organization @@ -144,7 +146,8 @@ public CaseController(DatabaseContext dbContext, SqidsEncoder sqids) DisplayName = sCase.DisplayName, SIO = sCase.Users.Where(cu => cu.IsSIO).Select(cu => new API.User { - Id = _sqids.Encode(cu.User.Id), JobTitle = cu.User.JobTitle, DisplayName = cu.User.DisplayName, + Id = _sqids.Encode(cu.User.Id), Auth0Id = cu.User.Auth0Id, + JobTitle = cu.User.JobTitle, DisplayName = cu.User.DisplayName, GivenName = cu.User.GivenName, LastName = cu.User.LastName, EmailAddress = cu.User.EmailAddress, ProfilePicture = cu.User.ProfilePicture, @@ -157,7 +160,8 @@ public CaseController(DatabaseContext dbContext, SqidsEncoder sqids) Status = sCase.Status, Users = sCase.Users.Select(cu => new API.User { - Id = _sqids.Encode(cu.User.Id), JobTitle = cu.User.JobTitle, DisplayName = cu.User.DisplayName, + Id = _sqids.Encode(cu.User.Id), Auth0Id = cu.User.Auth0Id, + JobTitle = cu.User.JobTitle, DisplayName = cu.User.DisplayName, GivenName = cu.User.GivenName, LastName = cu.User.LastName, EmailAddress = cu.User.EmailAddress, ProfilePicture = cu.User.ProfilePicture, Organization = new API.Organization @@ -459,7 +463,8 @@ await _dbContext.Entry(caseUser.User) DisplayName = sCase.DisplayName, SIO = new API.User { - Id = _sqids.Encode(SIOUser.Id), JobTitle = SIOUser.JobTitle, DisplayName = SIOUser.DisplayName, + Id = _sqids.Encode(SIOUser.Id), Auth0Id = SIOUser.Auth0Id, + JobTitle = SIOUser.JobTitle, DisplayName = SIOUser.DisplayName, GivenName = SIOUser.GivenName, LastName = SIOUser.LastName, EmailAddress = SIOUser.EmailAddress, ProfilePicture = SIOUser.ProfilePicture, @@ -472,7 +477,8 @@ await _dbContext.Entry(caseUser.User) Status = sCase.Status, Users = sCase.Users.Select(cu => new API.User { - Id = _sqids.Encode(cu.User.Id), JobTitle = cu.User.JobTitle, DisplayName = cu.User.DisplayName, + Id = _sqids.Encode(cu.User.Id), Auth0Id = cu.User.Auth0Id, + JobTitle = cu.User.JobTitle, DisplayName = cu.User.DisplayName, GivenName = cu.User.GivenName, LastName = cu.User.LastName, EmailAddress = cu.User.EmailAddress, ProfilePicture = cu.User.ProfilePicture, Organization = new API.Organization diff --git a/Controllers/Case/Export.cs b/Controllers/Case/Export.cs index b9b6ba4..319d38b 100644 --- a/Controllers/Case/Export.cs +++ b/Controllers/Case/Export.cs @@ -132,7 +132,8 @@ public async Task> ExportContemporaneousNotes(string caseId DisplayName = sCase.DisplayName, SIO = new API.User { - Id = _sqids.Encode(sioUser.Id), JobTitle = sioUser.JobTitle, DisplayName = sioUser.DisplayName, + Id = _sqids.Encode(sioUser.Id), Auth0Id = sioUser.Auth0Id, + JobTitle = sioUser.JobTitle, DisplayName = sioUser.DisplayName, GivenName = sioUser.GivenName, LastName = sioUser.LastName, EmailAddress = sioUser.EmailAddress, ProfilePicture = sioUser.ProfilePicture, Organization = new API.Organization @@ -144,7 +145,8 @@ public async Task> ExportContemporaneousNotes(string caseId Status = sCase.Status, Users = sCase.Users.Select(cu => new API.User { - Id = _sqids.Encode(cu.User.Id), JobTitle = cu.User.JobTitle, DisplayName = cu.User.DisplayName, + Id = _sqids.Encode(cu.User.Id), Auth0Id = cu.User.Auth0Id, + JobTitle = cu.User.JobTitle, DisplayName = cu.User.DisplayName, GivenName = cu.User.GivenName, LastName = cu.User.LastName, EmailAddress = cu.User.EmailAddress, ProfilePicture = cu.User.ProfilePicture, Organization = new API.Organization @@ -575,7 +577,8 @@ await minio.GetObjectAsync(new GetObjectArgs() Created = TimeZoneInfo.ConvertTimeFromUtc(contemporaneousNote.Created, timeZone), Creator = new API.User { - Id = _sqids.Encode(contemporaneousNote.Creator.Id), JobTitle = contemporaneousNote.Creator.JobTitle, + Id = _sqids.Encode(contemporaneousNote.Creator.Id), Auth0Id = contemporaneousNote.Creator.Auth0Id, + JobTitle = contemporaneousNote.Creator.JobTitle, DisplayName = contemporaneousNote.Creator.DisplayName, GivenName = contemporaneousNote.Creator.GivenName, LastName = contemporaneousNote.Creator.LastName, EmailAddress = contemporaneousNote.Creator.EmailAddress, @@ -731,7 +734,8 @@ await minio.GetObjectAsync(new GetObjectArgs() Created = TimeZoneInfo.ConvertTimeFromUtc(tab.Created, timeZone), Creator = new API.User { - Id = _sqids.Encode(tab.Creator.Id), JobTitle = tab.Creator.JobTitle, + Id = _sqids.Encode(tab.Creator.Id), Auth0Id = tab.Creator.Auth0Id, + JobTitle = tab.Creator.JobTitle, DisplayName = tab.Creator.DisplayName, GivenName = tab.Creator.GivenName, LastName = tab.Creator.LastName, EmailAddress = tab.Creator.EmailAddress, diff --git a/Controllers/Case/Shared/ContemporaneousNote.cs b/Controllers/Case/Shared/ContemporaneousNote.cs index c5a95c8..a6801e3 100644 --- a/Controllers/Case/Shared/ContemporaneousNote.cs +++ b/Controllers/Case/Shared/ContemporaneousNote.cs @@ -79,6 +79,7 @@ public SharedContemporaneousNotesController(DatabaseContext dbContext, SqidsEnco Creator = new API.User { Id = _sqids.Encode(cn.Creator.Id), + Auth0Id = cn.Creator.Auth0Id, DisplayName = cn.Creator.DisplayName, EmailAddress = cn.Creator.EmailAddress, GivenName = cn.Creator.GivenName, diff --git a/Controllers/Case/Shared/Tab.cs b/Controllers/Case/Shared/Tab.cs index 743cc01..bba7f89 100644 --- a/Controllers/Case/Shared/Tab.cs +++ b/Controllers/Case/Shared/Tab.cs @@ -80,6 +80,7 @@ public SharedTabsController(DatabaseContext dbContext, SqidsEncoder sqids) Creator = new API.User { Id = _sqids.Encode(t.Creator.Id), + Auth0Id = t.Creator.Auth0Id, DisplayName = t.Creator.DisplayName, EmailAddress = t.Creator.EmailAddress, GivenName = t.Creator.GivenName, @@ -162,6 +163,7 @@ public SharedTabsController(DatabaseContext dbContext, SqidsEncoder sqids) Creator = new API.User { Id = _sqids.Encode(tab.Creator.Id), + Auth0Id = tab.Creator.Auth0Id, DisplayName = tab.Creator.DisplayName, EmailAddress = tab.Creator.EmailAddress, GivenName = tab.Creator.GivenName, @@ -261,6 +263,7 @@ await _auditContext.LogAsync("Lighthouse Notes", Creator = new API.User { Id = _sqids.Encode(tabModel.Creator.Id), + Auth0Id = tabModel.Creator.Auth0Id, DisplayName = tabModel.Creator.DisplayName, EmailAddress = tabModel.Creator.EmailAddress, GivenName = tabModel.Creator.GivenName,