|
|
|
@ -8,6 +8,7 @@ using MongoDB.Driver.Linq; |
|
|
|
using Volo.Abp.Domain.Repositories.MongoDB; |
|
|
|
using Volo.Abp.MongoDB; |
|
|
|
using Volo.Abp.OpenIddict.MongoDB; |
|
|
|
using System.Linq.Dynamic.Core; |
|
|
|
|
|
|
|
namespace Volo.Abp.OpenIddict.Scopes; |
|
|
|
|
|
|
|
@ -16,6 +17,29 @@ public class MongoOpenIddictScopeRepository : MongoDbRepository<OpenIddictMongoD |
|
|
|
public MongoOpenIddictScopeRepository(IMongoDbContextProvider<OpenIddictMongoDbContext> dbContextProvider) : base(dbContextProvider) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<List<OpenIddictScope>> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return await (await GetMongoQueryableAsync(cancellationToken)) |
|
|
|
.WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Name.Contains(filter)) |
|
|
|
.WhereIf(!filter.IsNullOrWhiteSpace(), x => x.DisplayName.Contains(filter)) |
|
|
|
.WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Description.Contains(filter)) |
|
|
|
.OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(OpenIddictScope.Name) : sorting) |
|
|
|
.PageBy(skipCount, maxResultCount) |
|
|
|
.As<IMongoQueryable<OpenIddictScope>>() |
|
|
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<long> GetCountAsync(string filter = null, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return await (await GetMongoQueryableAsync(cancellationToken)) |
|
|
|
.WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Name.Contains(filter)) |
|
|
|
.WhereIf(!filter.IsNullOrWhiteSpace(), x => x.DisplayName.Contains(filter)) |
|
|
|
.WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Description.Contains(filter)) |
|
|
|
.As<IMongoQueryable<OpenIddictScope>>() |
|
|
|
.LongCountAsync(GetCancellationToken(cancellationToken)); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<OpenIddictScope> FindByIdAsync(Guid id, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
|