Skip to content

Commit

Permalink
Add Auth0ID to all user responses
Browse files Browse the repository at this point in the history
  • Loading branch information
bxdavies committed Jan 25, 2024
1 parent d309251 commit 5f2a5e0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
18 changes: 12 additions & 6 deletions Controllers/Case/Case.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public CaseController(DatabaseContext dbContext, SqidsEncoder<long> 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,
Expand All @@ -76,7 +77,8 @@ public CaseController(DatabaseContext dbContext, SqidsEncoder<long> 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
Expand Down Expand Up @@ -144,7 +146,8 @@ public CaseController(DatabaseContext dbContext, SqidsEncoder<long> 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,
Expand All @@ -157,7 +160,8 @@ public CaseController(DatabaseContext dbContext, SqidsEncoder<long> 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
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
12 changes: 8 additions & 4 deletions Controllers/Case/Export.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ public async Task<ActionResult<string>> 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
Expand All @@ -144,7 +145,8 @@ public async Task<ActionResult<string>> 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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions Controllers/Case/Shared/ContemporaneousNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions Controllers/Case/Shared/Tab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public SharedTabsController(DatabaseContext dbContext, SqidsEncoder<long> 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,
Expand Down Expand Up @@ -162,6 +163,7 @@ public SharedTabsController(DatabaseContext dbContext, SqidsEncoder<long> 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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 5f2a5e0

Please sign in to comment.