2025-12-08 01:37:35 +03:30
|
|
|
|
2025-12-08 21:10:21 +03:30
|
|
|
using Foursat.BackOffice.BFF.Commission.Protos;
|
2025-12-02 03:32:26 +03:30
|
|
|
|
|
|
|
|
namespace BackOffice.BFF.Application.CommissionCQ.Commands.TriggerWeeklyCalculation;
|
|
|
|
|
|
|
|
|
|
public class TriggerWeeklyCalculationCommandHandler : IRequestHandler<TriggerWeeklyCalculationCommand, TriggerWeeklyCalculationResponseDto>
|
|
|
|
|
{
|
|
|
|
|
private readonly IApplicationContractContext _context;
|
|
|
|
|
|
|
|
|
|
public TriggerWeeklyCalculationCommandHandler(IApplicationContractContext context)
|
|
|
|
|
{
|
|
|
|
|
_context = context;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<TriggerWeeklyCalculationResponseDto> Handle(TriggerWeeklyCalculationCommand request, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
var grpcRequest = new TriggerWeeklyCalculationRequest
|
|
|
|
|
{
|
|
|
|
|
WeekNumber = request.WeekNumber,
|
|
|
|
|
ForceRecalculate = request.ForceRecalculate,
|
|
|
|
|
SkipBalances = request.SkipBalances,
|
|
|
|
|
SkipPool = request.SkipPool,
|
|
|
|
|
SkipPayouts = request.SkipPayouts
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var response = await _context.Commissions.TriggerWeeklyCalculationAsync(grpcRequest, cancellationToken: cancellationToken);
|
|
|
|
|
|
|
|
|
|
return response.Adapt<TriggerWeeklyCalculationResponseDto>();
|
|
|
|
|
}
|
|
|
|
|
}
|