Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ public class TeamDetailModel

public TeamTypes TeamType { get; set; }

public List<StaffModel> Admins { get; set; }
public List<StaffModel> Admins { get; set; } = new();

public List<StaffModel> Members { get; set; }
public List<StaffModel> Members { get; set; } = new();

public List<RoleModel> AdminRoles { get; set; } = new();

public List<RoleModel> MemberRoles { get; set; } = new();

public TeamDetailModel()
{
Name = "";
Avatar = "";
Description = "";
Admins = new();
Members = new();
}

public TeamDetailModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public interface IUserService
{
Task<List<StaffModel>> GetListByTeamAsync(Guid teamId);

Task<List<StaffModel>> GetListByRoleAsync(Guid roleId);
Task<List<UserModel>> GetListByRoleAsync(Guid roleId);

Task<List<StaffModel>> GetListByDepartmentAsync(Guid departmentId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ public async Task<List<StaffModel>> GetListByDepartmentAsync(Guid departmentId)
return await _caller.GetAsync<object, List<StaffModel>>(requestUri, new { id = departmentId }) ?? new();
}

public async Task<List<StaffModel>> GetListByRoleAsync(Guid roleId)
public async Task<List<UserModel>> GetListByRoleAsync(Guid roleId)
{
var requestUri = $"api/staff/getListByRole";
return await _caller.GetAsync<object, List<StaffModel>>(requestUri, new { id = roleId }) ?? new();
var requestUri = $"api/user/getListByRole";
return await _caller.GetAsync<object, List<UserModel>>(requestUri, new { id = roleId }) ?? new();
}

public async Task<List<StaffModel>> GetListByTeamAsync(Guid teamId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ public async Task TestGetListByTeamAsync()
[TestMethod]
public async Task TestGetListByRoleAsync()
{
var data = new List<StaffModel>()
var data = new List<UserModel>()
{
new StaffModel()
new UserModel()
};
Guid roleId = Guid.NewGuid();
var requestUri = $"api/staff/getListByRole";
var requestUri = $"api/user/getListByRole";
var caller = new Mock<ICaller>();
caller.Setup(provider => provider.GetAsync<object, List<StaffModel>>(requestUri, It.IsAny<object>(), default)).ReturnsAsync(data).Verifiable();
caller.Setup(provider => provider.GetAsync<object, List<UserModel>>(requestUri, It.IsAny<object>(), default)).ReturnsAsync(data).Verifiable();
var userService = GetUserService(caller);
var result = await userService.GetListByRoleAsync(roleId);
caller.Verify(provider => provider.GetAsync<object, List<StaffModel>>(requestUri, It.IsAny<object>(), default), Times.Once);
caller.Verify(provider => provider.GetAsync<object, List<UserModel>>(requestUri, It.IsAny<object>(), default), Times.Once);
Assert.IsTrue(result.Count == 1);
}

Expand Down