public async Task <PaginationResult <RulesExecutionHistoryListVm> > Handle(
            GetRulesExecutionHistoryListQuery request, CancellationToken cancellationToken)
        {
            var query = _dbContext.RulesExecutionHistory
                        .AsNoTracking()
                        .OrderByDescending(x => x.Timestamp);

            int count = await query.CountAsync(cancellationToken);

            var result = await query
                         .AddPagination(request.PageNumber, request.PageSize)
                         .Select(x => new RulesExecutionHistoryListVm
            {
                Id              = x.Id,
                RuleId          = x.RuleId,
                RuleName        = x.Rule.Name,
                Timestamp       = x.Timestamp,
                ErrorMessage    = x.ErrorMessage,
                ExecutionStatus = x.ExecutionStatus
            })
                         .ToListAsync(cancellationToken);

            return(new PaginationResult <RulesExecutionHistoryListVm>
            {
                ResultTotalCount = count,
                PageNumber = request.PageNumber,
                PageSize = result.Count,
                Result = result
            });
        }
Ejemplo n.º 2
0
 public async Task<IActionResult> GetRulesExecutionHistoryList([FromQuery] GetRulesExecutionHistoryListQuery query)
 {
     return Ok(await _mediator.Send(query));
 }
Ejemplo n.º 3
0
 public Task <PaginationResult <RulesExecutionHistoryListVm> > GetRulesExecutionListHistory(GetRulesExecutionHistoryListQuery query, bool withCache = true)
 {
     return(_apiClient.Get <GetRulesExecutionHistoryListQuery, PaginationResult <RulesExecutionHistoryListVm> >(
                "Rules/execution-history/list", query,
                withCache ? null : _apiClient.NoCacheHeader));
 }