|
|
|
@ -189,11 +189,12 @@ public class MongoOrganizationUnitRepository |
|
|
|
int maxResultCount = int.MaxValue, |
|
|
|
int skipCount = 0, |
|
|
|
string filter = null, |
|
|
|
bool includeChildren = false, |
|
|
|
bool includeDetails = false, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
cancellationToken = GetCancellationToken(cancellationToken); |
|
|
|
var query = await CreateGetMembersFilteredQueryAsync(organizationUnit, filter, false, cancellationToken); |
|
|
|
var query = await CreateGetMembersFilteredQueryAsync(organizationUnit, filter, includeChildren, cancellationToken); |
|
|
|
return await query |
|
|
|
.OrderBy(sorting.IsNullOrEmpty() ? nameof(IdentityUser.UserName) : sorting) |
|
|
|
.As<IMongoQueryable<IdentityUser>>() |
|
|
|
@ -201,12 +202,12 @@ public class MongoOrganizationUnitRepository |
|
|
|
.ToListAsync(cancellationToken); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<List<Guid>> GetMemberIdsAsync(Guid id, CancellationToken cancellationToken = default) |
|
|
|
public virtual async Task<List<Guid>> GetMemberIdsAsync(Guid id, bool includeChildren = false, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
cancellationToken = GetCancellationToken(cancellationToken); |
|
|
|
return await (await GetMongoQueryableAsync<IdentityUser>(cancellationToken)) |
|
|
|
.Where(u => u.OrganizationUnits.Any(uou => uou.OrganizationUnitId == id)).Select(x => x.Id) |
|
|
|
.ToListAsync(cancellationToken); |
|
|
|
var organizationUnit = await GetAsync(id, cancellationToken: cancellationToken); |
|
|
|
var query = await CreateGetMembersFilteredQueryAsync(organizationUnit, null, includeChildren, cancellationToken); |
|
|
|
return await query.Select(x => x.Id).ToListAsync(cancellationToken); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<int> GetMembersCountAsync( |
|
|
|
|