|
|
|
@ -24,16 +24,44 @@ namespace Volo.Docs.Documents |
|
|
|
return await DbSet.Where(d => d.ProjectId == projectId).ToListAsync(cancellationToken: cancellationToken); |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<List<Document>> GetAllAsync(Guid? projectId, |
|
|
|
public async Task<List<Document>> GetAllAsync( |
|
|
|
Guid? projectId, |
|
|
|
string name, |
|
|
|
string version, |
|
|
|
string languageCode, |
|
|
|
string fileName, |
|
|
|
string format, |
|
|
|
DateTime? creationTimeMin, |
|
|
|
DateTime? creationTimeMax, |
|
|
|
DateTime? lastUpdatedTimeMin, |
|
|
|
DateTime? lastUpdatedTimeMax, |
|
|
|
DateTime? lastSignificantUpdateTimeMin, |
|
|
|
DateTime? lastSignificantUpdateTimeMax, |
|
|
|
DateTime? lastCachedTimeMin, |
|
|
|
DateTime? lastCachedTimeMax, |
|
|
|
string sorting = null, |
|
|
|
int maxResultCount = int.MaxValue, |
|
|
|
int skipCount = 0, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
var query = ApplyFilterForGetAll(DbSet, projectId, name, version, languageCode); |
|
|
|
var query = ApplyFilterForGetAll( |
|
|
|
DbSet, |
|
|
|
projectId: projectId, |
|
|
|
name: name, |
|
|
|
version: version, |
|
|
|
languageCode: languageCode, |
|
|
|
format: format, |
|
|
|
fileName: fileName, |
|
|
|
creationTimeMin: creationTimeMin, |
|
|
|
creationTimeMax: creationTimeMax, |
|
|
|
lastUpdatedTimeMin: lastUpdatedTimeMin, |
|
|
|
lastUpdatedTimeMax: lastUpdatedTimeMax, |
|
|
|
lastSignificantUpdateTimeMin: lastSignificantUpdateTimeMin, |
|
|
|
lastSignificantUpdateTimeMax: lastSignificantUpdateTimeMax, |
|
|
|
lastCachedTimeMin: lastCachedTimeMin, |
|
|
|
lastCachedTimeMax: lastCachedTimeMax |
|
|
|
); |
|
|
|
|
|
|
|
query = query.OrderBy(string.IsNullOrWhiteSpace(sorting) ? nameof(Document.Name) : sorting); |
|
|
|
return await query.PageBy(skipCount, maxResultCount).ToListAsync(cancellationToken); |
|
|
|
} |
|
|
|
@ -43,12 +71,39 @@ namespace Volo.Docs.Documents |
|
|
|
string name, |
|
|
|
string version, |
|
|
|
string languageCode, |
|
|
|
string fileName, |
|
|
|
string format, |
|
|
|
DateTime? creationTimeMin, |
|
|
|
DateTime? creationTimeMax, |
|
|
|
DateTime? lastUpdatedTimeMin, |
|
|
|
DateTime? lastUpdatedTimeMax, |
|
|
|
DateTime? lastSignificantUpdateTimeMin, |
|
|
|
DateTime? lastSignificantUpdateTimeMax, |
|
|
|
DateTime? lastCachedTimeMin, |
|
|
|
DateTime? lastCachedTimeMax, |
|
|
|
string sorting = null, |
|
|
|
int maxResultCount = int.MaxValue, |
|
|
|
int skipCount = 0, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
var query = ApplyFilterForGetAll(DbSet, projectId, name, version, languageCode); |
|
|
|
var query = ApplyFilterForGetAll( |
|
|
|
DbSet, |
|
|
|
projectId: projectId, |
|
|
|
name: name, |
|
|
|
version: version, |
|
|
|
languageCode: languageCode, |
|
|
|
format: format, |
|
|
|
fileName: fileName, |
|
|
|
creationTimeMin: creationTimeMin, |
|
|
|
creationTimeMax: creationTimeMax, |
|
|
|
lastUpdatedTimeMin: lastUpdatedTimeMin, |
|
|
|
lastUpdatedTimeMax: lastUpdatedTimeMax, |
|
|
|
lastSignificantUpdateTimeMin: lastSignificantUpdateTimeMin, |
|
|
|
lastSignificantUpdateTimeMax: lastSignificantUpdateTimeMax, |
|
|
|
lastCachedTimeMin: lastCachedTimeMin, |
|
|
|
lastCachedTimeMax: lastCachedTimeMax |
|
|
|
); |
|
|
|
|
|
|
|
return await query.LongCountAsync(GetCancellationToken(cancellationToken)); |
|
|
|
} |
|
|
|
|
|
|
|
@ -81,13 +136,47 @@ namespace Volo.Docs.Documents |
|
|
|
string name, |
|
|
|
string version, |
|
|
|
string languageCode, |
|
|
|
string fileName, |
|
|
|
string format, |
|
|
|
DateTime? creationTimeMin, |
|
|
|
DateTime? creationTimeMax, |
|
|
|
DateTime? lastUpdatedTimeMin, |
|
|
|
DateTime? lastUpdatedTimeMax, |
|
|
|
DateTime? lastSignificantUpdateTimeMin, |
|
|
|
DateTime? lastSignificantUpdateTimeMax, |
|
|
|
DateTime? lastCachedTimeMin, |
|
|
|
DateTime? lastCachedTimeMax, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return DbSet |
|
|
|
.WhereIf(projectId.HasValue, d => d.ProjectId == projectId.Value) |
|
|
|
.WhereIf(name != null, d => d.Name != null && d.Name.Contains(name)) |
|
|
|
.WhereIf(version != null, d => d.Version != null && d.Version == version) |
|
|
|
.WhereIf(languageCode != null, d => d.LanguageCode != null && d.LanguageCode == languageCode); |
|
|
|
.WhereIf(projectId.HasValue, |
|
|
|
d => d.ProjectId == projectId.Value) |
|
|
|
.WhereIf(name != null, |
|
|
|
d => d.Name != null && d.Name.Contains(name)) |
|
|
|
.WhereIf(version != null, |
|
|
|
d => d.Version != null && d.Version == version) |
|
|
|
.WhereIf(languageCode != null, |
|
|
|
d => d.LanguageCode != null && d.LanguageCode == languageCode) |
|
|
|
.WhereIf(fileName != null, |
|
|
|
d => d.FileName != null && d.FileName.Contains(fileName)) |
|
|
|
.WhereIf(format != null, |
|
|
|
d => d.Format != null && d.Format == format) |
|
|
|
.WhereIf(creationTimeMin.HasValue, |
|
|
|
d => d.CreationTime.Date >= creationTimeMin.Value.Date) |
|
|
|
.WhereIf(creationTimeMax.HasValue, |
|
|
|
d => d.CreationTime.Date <= creationTimeMax.Value.Date) |
|
|
|
.WhereIf(lastUpdatedTimeMin.HasValue, |
|
|
|
d => d.LastUpdatedTime.Date >= lastUpdatedTimeMin.Value.Date) |
|
|
|
.WhereIf(lastUpdatedTimeMax.HasValue, |
|
|
|
d => d.LastUpdatedTime.Date <= lastUpdatedTimeMax.Value.Date) |
|
|
|
.WhereIf(lastSignificantUpdateTimeMin.HasValue, |
|
|
|
d => d.LastSignificantUpdateTime != null && d.LastSignificantUpdateTime.Value.Date >= lastSignificantUpdateTimeMin.Value.Date) |
|
|
|
.WhereIf(lastSignificantUpdateTimeMax.HasValue, |
|
|
|
d => d.LastSignificantUpdateTime != null && d.LastSignificantUpdateTime.Value.Date <= lastSignificantUpdateTimeMax.Value.Date) |
|
|
|
.WhereIf(lastCachedTimeMin.HasValue, |
|
|
|
d => d.LastCachedTime.Date >= lastCachedTimeMin.Value.Date) |
|
|
|
.WhereIf(lastCachedTimeMax.HasValue, |
|
|
|
d => d.LastCachedTime.Date <= lastCachedTimeMax.Value.Date); |
|
|
|
} |
|
|
|
} |
|
|
|
} |