Add response DTOs for withdrawal and club activation commands
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ApproveWithdrawal;
|
||||
|
||||
public record ApproveWithdrawalCommand : IRequest<ApproveWithdrawalResponseDto>
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه درخواست برداشت
|
||||
/// </summary>
|
||||
public long WithdrawalId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// یادداشت مدیر (اختیاری)
|
||||
/// </summary>
|
||||
public string? AdminNote { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using BackOffice.BFF.Commission.Protobuf;
|
||||
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ApproveWithdrawal;
|
||||
|
||||
public class ApproveWithdrawalCommandHandler : IRequestHandler<ApproveWithdrawalCommand, ApproveWithdrawalResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public ApproveWithdrawalCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<ApproveWithdrawalResponseDto> Handle(ApproveWithdrawalCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var grpcRequest = new ApproveWithdrawalRequest
|
||||
{
|
||||
WithdrawalId = request.WithdrawalId,
|
||||
AdminNote = request.AdminNote ?? string.Empty
|
||||
};
|
||||
|
||||
var response = await _context.Commissions.ApproveWithdrawalAsync(grpcRequest, cancellationToken: cancellationToken);
|
||||
|
||||
return new ApproveWithdrawalResponseDto
|
||||
{
|
||||
Success = response.Success,
|
||||
Message = response.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ApproveWithdrawal;
|
||||
|
||||
public record ApproveWithdrawalResponseDto
|
||||
{
|
||||
public bool Success { get; init; }
|
||||
public string Message { get; init; } = string.Empty;
|
||||
}
|
||||
Reference in New Issue
Block a user