Skip to content

Commit

Permalink
Fix names not populating on list endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
NixFey committed Jun 3, 2024
1 parent e9123c7 commit a2a4c02
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions FiMAdminApi/Controllers/UsersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public async Task<ActionResult> GetUsers([FromQuery] string? searchTerm = null)

var profiles = await dbContext.Profiles.Where(p => selectedUsers.Select(u => u.Id).Contains(p.Id))
.ToDictionaryAsync(p => p.Id);
foreach (var user in selectedUsers)

return Ok(selectedUsers.Select(user =>
{
if (user.Id is not null && profiles.TryGetValue(user.Id.Value, out var profile) &&
!string.IsNullOrWhiteSpace(profile.Name))
Expand All @@ -62,9 +63,9 @@ public async Task<ActionResult> GetUsers([FromQuery] string? searchTerm = null)
{
user.Name = user.Email;
}
}

return Ok(selectedUsers);

return user;
}).ToList());
}

/// <summary>
Expand Down

0 comments on commit a2a4c02

Please sign in to comment.