Правка по результатам тестирования
This commit is contained in:
parent
e826a386d2
commit
f647afcd53
@ -10,7 +10,7 @@ namespace Persistence.Repository;
|
||||
/// </summary>
|
||||
public static class QueryBuilders
|
||||
{
|
||||
public static void Apply<TEntity>(this IQueryable<TEntity> query, SectionPartRequest request)
|
||||
public static IQueryable<TEntity> Apply<TEntity>(this IQueryable<TEntity> query, SectionPartRequest request)
|
||||
where TEntity : class, IWithSectionPart
|
||||
{
|
||||
if (request.IdSection.HasValue)
|
||||
@ -25,9 +25,11 @@ public static class QueryBuilders
|
||||
{
|
||||
query = query.Where(e => e.DepthEnd <= request.DepthEnd);
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
public static void Apply<TEntity>(this IQueryable<TEntity> query,DateTimeOffset momentUtc)
|
||||
public static IQueryable<TEntity> Apply<TEntity>(this IQueryable<TEntity> query,DateTimeOffset momentUtc)
|
||||
where TEntity : class, IChangeLog
|
||||
{
|
||||
momentUtc = momentUtc.ToUniversalTime();
|
||||
@ -35,6 +37,8 @@ public static class QueryBuilders
|
||||
query = query
|
||||
.Where(e => e.Creation <= momentUtc)
|
||||
.Where(e => e.Obsolete == null || e.Obsolete >= momentUtc);
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
|
@ -139,8 +139,8 @@ public class ChangeLogRepository : IChangeLogRepository
|
||||
CancellationToken token)
|
||||
{
|
||||
var query = CreateQuery(idDiscriminator);
|
||||
query.Apply(momentUtc);
|
||||
query.Apply(filterRequest);
|
||||
query = query.Apply(momentUtc);
|
||||
query = query.Apply(filterRequest);
|
||||
|
||||
var result = await query.ApplyPagination(paginationRequest, Convert, token);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user