Browse Source

added GetListByProjectId method to IDocumentRepository

pull/3680/head
Yunus Emre Kalkan 7 years ago
parent
commit
c05eb0ecf1
  1. 2
      modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs
  2. 4
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentRepository.cs
  3. 8
      modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Documents/EFCoreDocumentRepository.cs
  4. 7
      modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs

2
modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs

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

4
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentRepository.cs

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

8
modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Documents/EFCoreDocumentRepository.cs

@ -1,4 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore; 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, public async Task<Document> FindAsync(Guid projectId, string name, string languageCode, string version,
bool includeDetails = true, bool includeDetails = true,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)

7
modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs

@ -1,6 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Driver.Linq; using MongoDB.Driver.Linq;
using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.Domain.Repositories.MongoDB;
using Volo.Abp.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, public async Task<Document> FindAsync(Guid projectId, string name, string languageCode, string version,
bool includeDetails = true, bool includeDetails = true,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)

Loading…
Cancel
Save