|
|
@ -20,7 +20,7 @@ namespace Volo.Docs.Documents |
|
|
{ |
|
|
{ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<List<DocumentWithoutDetails>> GetListWithoutDetailsByProjectId(Guid projectId, CancellationToken cancellationToken = default) |
|
|
public virtual async Task<List<DocumentWithoutDetails>> GetListWithoutDetailsByProjectId(Guid projectId, CancellationToken cancellationToken = default) |
|
|
{ |
|
|
{ |
|
|
return await (await GetMongoQueryableAsync(cancellationToken)) |
|
|
return await (await GetMongoQueryableAsync(cancellationToken)) |
|
|
.Where(d => d.ProjectId == projectId) |
|
|
.Where(d => d.ProjectId == projectId) |
|
|
@ -34,7 +34,7 @@ namespace Volo.Docs.Documents |
|
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<List<DocumentInfo>> GetUniqueListDocumentInfoAsync(CancellationToken cancellationToken = default) |
|
|
public virtual async Task<List<DocumentInfo>> GetUniqueListDocumentInfoAsync(CancellationToken cancellationToken = default) |
|
|
{ |
|
|
{ |
|
|
return await (await GetMongoQueryableAsync(cancellationToken)) |
|
|
return await (await GetMongoQueryableAsync(cancellationToken)) |
|
|
.Select(x=> new DocumentInfo { |
|
|
.Select(x=> new DocumentInfo { |
|
|
@ -48,12 +48,12 @@ namespace Volo.Docs.Documents |
|
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<List<Document>> GetListByProjectId(Guid projectId, CancellationToken cancellationToken = default) |
|
|
public virtual async Task<List<Document>> GetListByProjectId(Guid projectId, CancellationToken cancellationToken = default) |
|
|
{ |
|
|
{ |
|
|
return await (await GetMongoQueryableAsync(cancellationToken)).Where(d => d.ProjectId == projectId).ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
return await (await GetMongoQueryableAsync(cancellationToken)).Where(d => d.ProjectId == projectId).ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<Document> FindAsync(Guid projectId, string name, string languageCode, string version, |
|
|
public virtual async Task<Document> FindAsync(Guid projectId, string name, string languageCode, string version, |
|
|
bool includeDetails = true, |
|
|
bool includeDetails = true, |
|
|
CancellationToken cancellationToken = default) |
|
|
CancellationToken cancellationToken = default) |
|
|
{ |
|
|
{ |
|
|
@ -63,14 +63,14 @@ namespace Volo.Docs.Documents |
|
|
x.Version == version, GetCancellationToken(cancellationToken)); |
|
|
x.Version == version, GetCancellationToken(cancellationToken)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task DeleteAsync(Guid projectId, string name, string languageCode, string version, bool autoSave = false, CancellationToken cancellationToken = default) |
|
|
public virtual async Task DeleteAsync(Guid projectId, string name, string languageCode, string version, bool autoSave = false, CancellationToken cancellationToken = default) |
|
|
{ |
|
|
{ |
|
|
await DeleteAsync(x => |
|
|
await DeleteAsync(x => |
|
|
x.ProjectId == projectId && x.Name == name && x.LanguageCode == languageCode && |
|
|
x.ProjectId == projectId && x.Name == name && x.LanguageCode == languageCode && |
|
|
x.Version == version, autoSave, cancellationToken: cancellationToken); |
|
|
x.Version == version, autoSave, cancellationToken: cancellationToken); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<List<Document>> GetListAsync(Guid? projectId, string version, string name, CancellationToken cancellationToken = default) |
|
|
public virtual async Task<List<Document>> GetListAsync(Guid? projectId, string version, string name, CancellationToken cancellationToken = default) |
|
|
{ |
|
|
{ |
|
|
return await (await GetMongoQueryableAsync(cancellationToken)) |
|
|
return await (await GetMongoQueryableAsync(cancellationToken)) |
|
|
.WhereIf(version != null, x => x.Version == version) |
|
|
.WhereIf(version != null, x => x.Version == version) |
|
|
@ -80,7 +80,7 @@ namespace Volo.Docs.Documents |
|
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<List<DocumentWithoutContent>> GetAllAsync( |
|
|
public virtual async Task<List<DocumentWithoutContent>> GetAllAsync( |
|
|
Guid? projectId, |
|
|
Guid? projectId, |
|
|
string name, |
|
|
string name, |
|
|
string version, |
|
|
string version, |
|
|
@ -122,7 +122,7 @@ namespace Volo.Docs.Documents |
|
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<long> GetAllCountAsync( |
|
|
public virtual async Task<long> GetAllCountAsync( |
|
|
Guid? projectId, |
|
|
Guid? projectId, |
|
|
string name, |
|
|
string name, |
|
|
string version, |
|
|
string version, |
|
|
@ -165,7 +165,7 @@ namespace Volo.Docs.Documents |
|
|
.LongCountAsync(GetCancellationToken(cancellationToken)); |
|
|
.LongCountAsync(GetCancellationToken(cancellationToken)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<Document> GetAsync(Guid id, CancellationToken cancellationToken = default) |
|
|
public virtual async Task<Document> GetAsync(Guid id, CancellationToken cancellationToken = default) |
|
|
{ |
|
|
{ |
|
|
return await (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.Id == id).SingleAsync(GetCancellationToken(cancellationToken)); |
|
|
return await (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.Id == id).SingleAsync(GetCancellationToken(cancellationToken)); |
|
|
} |
|
|
} |
|
|
|