added GetListByProjectId method to IDocumentRepository

pull/3680/head
Yunus Emre Kalkan 5 years ago
parent 669e0e9ca5
commit c05eb0ecf1

@ -64,7 +64,7 @@ namespace Volo.Docs.Admin.Documents
await _languageCache.RemoveAsync(languageCacheKey, true);
await _versionCache.RemoveAsync(versionCacheKey, true);
var documents = await _documentRepository.GetListAsync();
var documents = await _documentRepository.GetListByProjectId(project.Id);
foreach (var languageCode in languageConfig.Languages)
{

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
@ -7,6 +8,9 @@ namespace Volo.Docs.Documents
{
public interface IDocumentRepository : IBasicRepository<Document>
{
Task<List<Document>> GetListByProjectId(Guid projectId,
CancellationToken cancellationToken = default);
Task<Document> FindAsync(Guid projectId, string name, string languageCode, string version,
bool includeDetails = true,
CancellationToken cancellationToken = default);

@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
@ -15,6 +17,12 @@ namespace Volo.Docs.Documents
{
}
public async Task<List<Document>> GetListByProjectId(Guid projectId,
CancellationToken cancellationToken = default)
{
return await DbSet.Where(d => d.ProjectId == projectId).ToListAsync(cancellationToken: cancellationToken);
}
public async Task<Document> FindAsync(Guid projectId, string name, string languageCode, string version,
bool includeDetails = true,
CancellationToken cancellationToken = default)

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Driver.Linq;
using Volo.Abp.Domain.Repositories.MongoDB;
using Volo.Abp.MongoDB;
@ -15,6 +17,11 @@ namespace Volo.Docs.Documents
{
}
public async Task<List<Document>> GetListByProjectId(Guid projectId, CancellationToken cancellationToken = default)
{
return await GetMongoQueryable().Where(d => d.ProjectId == projectId).ToListAsync(cancellationToken);
}
public async Task<Document> FindAsync(Guid projectId, string name, string languageCode, string version,
bool includeDetails = true,
CancellationToken cancellationToken = default)

Loading…
Cancel
Save