feat: Implement Approve and Reject Withdrawal commands with handlers
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
namespace CMSMicroservice.Application.CommissionCQ.Queries.GetWorkerStatus;
|
||||
|
||||
public record GetWorkerStatusQuery : IRequest<GetWorkerStatusResponseDto>
|
||||
{
|
||||
// Empty - returns current worker status
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
using CMSMicroservice.Application.Common.Interfaces;
|
||||
|
||||
namespace CMSMicroservice.Application.CommissionCQ.Queries.GetWorkerStatus;
|
||||
|
||||
public class GetWorkerStatusQueryHandler : IRequestHandler<GetWorkerStatusQuery, GetWorkerStatusResponseDto>
|
||||
{
|
||||
private readonly IApplicationDbContext _context;
|
||||
|
||||
public GetWorkerStatusQueryHandler(IApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<GetWorkerStatusResponseDto> Handle(
|
||||
GetWorkerStatusQuery request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
// TODO: این باید از یک service یا cache واقعی worker status را بگیرد
|
||||
// فعلاً mock data برمیگرداند
|
||||
|
||||
await Task.CompletedTask;
|
||||
|
||||
return new GetWorkerStatusResponseDto
|
||||
{
|
||||
IsRunning = false,
|
||||
IsEnabled = true,
|
||||
CurrentExecutionId = null,
|
||||
CurrentWeekNumber = null,
|
||||
CurrentStep = "Idle",
|
||||
LastRunAt = DateTime.UtcNow.AddHours(-24),
|
||||
NextScheduledRun = DateTime.UtcNow.AddDays(7),
|
||||
TotalExecutions = 48,
|
||||
SuccessfulExecutions = 47,
|
||||
FailedExecutions = 1
|
||||
};
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
namespace CMSMicroservice.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; } // "Balances" | "Pool" | "Payouts" | "Idle"
|
||||
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; }
|
||||
}
|
||||
Reference in New Issue
Block a user