adde GetAllBetweenDatesAsync to IAuditLogRepository

pull/1549/head
Yunus Emre Kalkan 6 years ago
parent 6ed9493b36
commit 3592b7293b

@ -36,5 +36,10 @@ namespace Volo.Abp.AuditLogging
bool? hasException = null,
HttpStatusCode? httpStatusCode = null,
CancellationToken cancellationToken = default);
Task<List<AuditLog>> GetAllBetweenDatesAsync(
DateTime startDate,
DateTime endDate,
CancellationToken cancellationToken = default);
}
}

@ -39,7 +39,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
var auditLogs = await query.OrderBy(sorting ?? "executionTime desc")
.PageBy(skipCount, maxResultCount)
.ToListAsync();
.ToListAsync(cancellationToken: cancellationToken);
return auditLogs;
}
@ -58,11 +58,17 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
{
var query = GetListQuery(httpMethod, url, userName, applicationName, correlationId, maxExecutionDuration, minExecutionDuration, hasException, httpStatusCode);
var totalCount = await query.LongCountAsync();
var totalCount = await query.LongCountAsync(cancellationToken: cancellationToken);
return totalCount;
}
public async Task<List<AuditLog>> GetAllBetweenDatesAsync(DateTime startDate, DateTime endDate,
CancellationToken cancellationToken = default)
{
return await DbSet.Where(a => a.ExecutionTime < endDate && a.ExecutionTime > startDate).ToListAsync(cancellationToken: cancellationToken);
}
private IQueryable<AuditLog> GetListQuery(
string httpMethod = null,
string url = null,

@ -62,6 +62,12 @@ namespace Volo.Abp.AuditLogging.MongoDB
return count;
}
public async Task<List<AuditLog>> GetAllBetweenDatesAsync(DateTime startDate, DateTime endDate,
CancellationToken cancellationToken = default)
{
return await GetMongoQueryable().Where(a => a.ExecutionTime < endDate && a.ExecutionTime > startDate).ToListAsync(cancellationToken: cancellationToken);
}
private IQueryable<AuditLog> GetListQuery(
string httpMethod = null,
string url = null,

Loading…
Cancel
Save