Skip to content

Fix/slow loading issue and graph api user search#272

Open
rupakkatwal wants to merge 5 commits intofeat/dotnet-apifrom
fix/slow-loading-issue-and-graph-api-user-search
Open

Fix/slow loading issue and graph api user search#272
rupakkatwal wants to merge 5 commits intofeat/dotnet-apifrom
fix/slow-loading-issue-and-graph-api-user-search

Conversation

@rupakkatwal
Copy link
Contributor

No description provided.

Copy link
Collaborator

@EinarSalbouvet EinarSalbouvet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, just a couple comments

Comment on lines +38 to 42
[HttpGet("users/azure-id/{azureId}")]
public async Task<ActionResult<UserOutgoingDto>> GetUserByAzureId(string azureId)
{
var result = await _userService.GetAsync(new List<string> { id });
var result = await _userService.GetAsync([azureId]);
return result.Count > 0 ? Ok(result[0]) : NotFound();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the changes to the database the azure id is now just the user id

{
config.QueryParameters.Search = $"\"displayName:{sanitizedQuery}\" OR \"mail:{sanitizedQuery}\"";
config.QueryParameters.Select = new[] { "id", "displayName", "mail", "userPrincipalName" };
config.QueryParameters.Top = 100;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to have some of these as application constants

Comment on lines +98 to +104
private static string SanitizeSearchQuery(string query)
{
var sanitized = query.Trim();
sanitized = Regex.Replace(sanitized, @"\s+", " ");
sanitized = Regex.Replace(sanitized, @"[""'\\(){}[\];]", string.Empty);
return sanitized;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: This seems useful as a string extension, so it can be used every where. that would require a rename.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants