2025-12-08 01:37:35 +03:30
|
|
|
|
2025-12-12 05:57:32 +03:30
|
|
|
|
|
|
|
|
using CMSMicroservice.Protobuf.Protos.Commission;
|
2025-12-02 03:32:26 +03:30
|
|
|
|
|
|
|
|
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>();
|
|
|
|
|
}
|
|
|
|
|
}
|