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,6 @@
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWorkerStatus;
public class GetWorkerStatusQuery : IRequest<GetWorkerStatusResponseDto>
{
// No parameters needed - returns current worker status
}
@@ -0,0 +1,22 @@
using BackOffice.BFF.Commission.Protobuf;
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWorkerStatus;
public class GetWorkerStatusQueryHandler : IRequestHandler<GetWorkerStatusQuery, GetWorkerStatusResponseDto>
{
private readonly IApplicationContractContext _context;
public GetWorkerStatusQueryHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<GetWorkerStatusResponseDto> Handle(GetWorkerStatusQuery request, CancellationToken cancellationToken)
{
var grpcRequest = new GetWorkerStatusRequest();
var response = await _context.Commissions.GetWorkerStatusAsync(grpcRequest, cancellationToken: cancellationToken);
return response.Adapt<GetWorkerStatusResponseDto>();
}
}
@@ -0,0 +1,15 @@
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWorkerStatus;
public class GetWorkerStatusResponseDto
{
public bool IsRunning { get; set; }
public bool IsEnabled { get; set; }
public string? CurrentExecutionId { get; set; }
public string? CurrentWeekNumber { get; set; }
public string? CurrentStep { get; set; }
public DateTime? LastRunAt { get; set; }
public DateTime? NextScheduledRun { get; set; }
public int TotalExecutions { get; set; }
public int SuccessfulExecutions { get; set; }
public int FailedExecutions { get; set; }
}