Browse Source
Merge pull request #22543 from abpframework/GetQueryableAsync
Fix merge problem of `GetQueryableAsync` method.
pull/22544/head
Muhammed Ali ÖZKAYA
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
15 additions and
2 deletions
-
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs
|
|
|
@ -362,8 +362,21 @@ public class MongoIdentityUserRepository : MongoDbRepository<IAbpIdentityMongoDb |
|
|
|
|
|
|
|
public virtual async Task UpdateOrganizationAsync(Guid sourceOrganizationId, Guid? targetOrganizationId, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
var sourceOrganizationUnit = await (await GetQueryableAsync<OrganizationUnit>(cancellationToken)) |
|
|
|
.Where(x => x.Id == sourceOrganizationId) |
|
|
|
.FirstOrDefaultAsync(cancellationToken: cancellationToken); |
|
|
|
if (sourceOrganizationUnit == null) |
|
|
|
{ |
|
|
|
throw new EntityNotFoundException(typeof(OrganizationUnit), sourceOrganizationId); |
|
|
|
} |
|
|
|
|
|
|
|
var allSourceOrganizationIds = await (await GetQueryableAsync<OrganizationUnit>(cancellationToken)) |
|
|
|
.Where(x => x.Code.StartsWith(sourceOrganizationUnit.Code)) |
|
|
|
.Select(x => x.Id) |
|
|
|
.ToListAsync(cancellationToken: cancellationToken); |
|
|
|
|
|
|
|
var users = await (await GetQueryableAsync(cancellationToken)) |
|
|
|
.Where(x => x.OrganizationUnits.Any(r => r.OrganizationUnitId == sourceOrganizationId)) |
|
|
|
.Where(x => x.OrganizationUnits.Any(r => allSourceOrganizationIds.Contains(r.OrganizationUnitId))) |
|
|
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
|
|
|
|
|
foreach (var user in users) |
|
|
|
@ -458,7 +471,7 @@ public class MongoIdentityUserRepository : MongoDbRepository<IAbpIdentityMongoDb |
|
|
|
{ |
|
|
|
return query.Where(x => x.Id == id); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (roleId.HasValue) |
|
|
|
{ |
|
|
|
var organizationUnitIds = (await GetQueryableAsync<OrganizationUnit>(cancellationToken)) |
|
|
|
|