This commit is contained in:
masoodafar-web
2025-12-02 03:32:26 +03:30
parent 6cd29e8b26
commit c9dab944fa
56 changed files with 1181 additions and 710 deletions
@@ -0,0 +1,11 @@
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWorkerExecutionLogs;
public class GetWorkerExecutionLogsQuery : IRequest<GetWorkerExecutionLogsResponseDto>
{
public string? WeekNumber { get; set; }
public string? ExecutionId { get; set; }
public bool? SuccessOnly { get; set; }
public bool? FailedOnly { get; set; }
public int PageIndex { get; set; }
public int PageSize { get; set; }
}
@@ -0,0 +1,46 @@
using BackOffice.BFF.Commission.Protobuf;
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWorkerExecutionLogs;
public class GetWorkerExecutionLogsQueryHandler : IRequestHandler<GetWorkerExecutionLogsQuery, GetWorkerExecutionLogsResponseDto>
{
private readonly IApplicationContractContext _context;
public GetWorkerExecutionLogsQueryHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<GetWorkerExecutionLogsResponseDto> Handle(GetWorkerExecutionLogsQuery request, CancellationToken cancellationToken)
{
var grpcRequest = new GetWorkerExecutionLogsRequest
{
PageIndex = request.PageIndex,
PageSize = request.PageSize
};
if (!string.IsNullOrWhiteSpace(request.WeekNumber))
{
grpcRequest.WeekNumber = request.WeekNumber;
}
if (!string.IsNullOrWhiteSpace(request.ExecutionId))
{
grpcRequest.ExecutionId = request.ExecutionId;
}
if (request.SuccessOnly.HasValue)
{
grpcRequest.SuccessOnly = request.SuccessOnly.Value;
}
if (request.FailedOnly.HasValue)
{
grpcRequest.FailedOnly = request.FailedOnly.Value;
}
var response = await _context.Commissions.GetWorkerExecutionLogsAsync(grpcRequest, cancellationToken: cancellationToken);
return response.Adapt<GetWorkerExecutionLogsResponseDto>();
}
}
@@ -0,0 +1,23 @@
using BackOffice.BFF.Application.Common.Models;
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWorkerExecutionLogs;
public class GetWorkerExecutionLogsResponseDto
{
public MetaData MetaData { get; set; } = new();
public List<WorkerExecutionLogModel> Models { get; set; } = new();
}
public class WorkerExecutionLogModel
{
public string ExecutionId { get; set; } = string.Empty;
public string WeekNumber { get; set; } = string.Empty;
public string Step { get; set; } = string.Empty;
public bool Success { get; set; }
public string? ErrorMessage { get; set; }
public DateTime StartedAt { get; set; }
public DateTime CompletedAt { get; set; }
public long DurationMs { get; set; }
public int RecordsProcessed { get; set; }
public string? Details { get; set; }
}