Skip to content

Commit

Permalink
Fix bug8 (#113)
Browse files Browse the repository at this point in the history
* fix reset password routing and get top users

* fix (reset paswword forgotten ) : fix url website

* fix (Search user for access file ): fix tesets
  • Loading branch information
mahdijafariii authored Sep 9, 2024
1 parent 00b9d6b commit b4914ca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public async Task<bool> UpdateUserAsync(Guid id, User newUser)
public async Task<IEnumerable<User>> GetTopUsersByUsernameSearchAsync(string username)
{
return await _context.Users.Include(u => u.Role)
.Where(x => x.Username.ToLower().Contains(username.ToLower()) && x.Role.RoleName != "data-analyst").Take(10).ToListAsync();
.Where(x => x.Username.ToLower().Contains(username.ToLower()) && x.Role.RoleName == "data-analyst").Take(10).ToListAsync();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public async Task SendRequestToResetPassword(string email)
}

var token = await _jwtService.RequestResetPassword(user);
await _emailService.SendPasswordResetEmail(user.Email, "https://myfronti.abriment.com",token);
await _emailService.SendPasswordResetEmail(user.Email, "https://myfronti.abriment.com/reset-password",token);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ public async Task
var roleManager = new Role { RoleName = "Manager", RolePolicy = "silver" };
var roleAnalyst = new Role { RoleName = "data-analyst", RolePolicy = "bronze" };

var users = new List<AnalysisData.Models.UserModel.User>
var users = new List<User>
{
new()
{
Expand Down Expand Up @@ -595,8 +595,8 @@ public async Task
// Assert
Assert.NotNull(result);
var resultList = result.ToList();
Assert.Equal(2, resultList.Count);
Assert.DoesNotContain(resultList, u => u.Username == "usertest3");
Assert.Equal(1, resultList.Count);
Assert.Contains(resultList, u => u.Username == "usertest3");
}

[Fact]
Expand All @@ -608,9 +608,9 @@ public async Task GetTopUsersByUsernameSearchAsync_ShouldReturnEmptyList_WhenNoU
// Arrange
var roleAdmin = new Role { RoleName = "Admin", RolePolicy = "gold" };
var roleManager = new Role { RoleName = "Manager", RolePolicy = "silver" };
var roleAnalyst = new Role { RoleName = "dataanalyst", RolePolicy = "bronze" };
var roleAnalyst = new Role { RoleName = "data-analyst", RolePolicy = "bronze" };

var users = new List<AnalysisData.Models.UserModel.User>
var users = new List<User>
{
new()
{
Expand Down

0 comments on commit b4914ca

Please sign in to comment.