Add response DTOs for withdrawal and club activation commands
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWithdrawalRequests;
|
||||
|
||||
public record GetWithdrawalRequestsQuery : IRequest<GetWithdrawalRequestsResponseDto>
|
||||
{
|
||||
/// <summary>
|
||||
/// شماره صفحه (پیشفرض: 1)
|
||||
/// </summary>
|
||||
public int PageIndex { get; init; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// تعداد در هر صفحه (پیشفرض: 10)
|
||||
/// </summary>
|
||||
public int PageSize { get; init; } = 10;
|
||||
|
||||
/// <summary>
|
||||
/// فیلتر وضعیت (اختیاری): 0=Pending, 1=Approved, 2=Rejected, 3=Processed
|
||||
/// </summary>
|
||||
public int? Status { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// فیلتر شناسه کاربر (اختیاری)
|
||||
/// </summary>
|
||||
public long? UserId { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using BackOffice.BFF.Commission.Protobuf;
|
||||
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWithdrawalRequests;
|
||||
|
||||
public class GetWithdrawalRequestsQueryHandler : IRequestHandler<GetWithdrawalRequestsQuery, GetWithdrawalRequestsResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public GetWithdrawalRequestsQueryHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<GetWithdrawalRequestsResponseDto> Handle(GetWithdrawalRequestsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var grpcRequest = new GetWithdrawalRequestsRequest
|
||||
{
|
||||
PageIndex = request.PageIndex,
|
||||
PageSize = request.PageSize
|
||||
};
|
||||
|
||||
if (request.Status.HasValue)
|
||||
{
|
||||
grpcRequest.Status = request.Status.Value;
|
||||
}
|
||||
|
||||
if (request.UserId.HasValue)
|
||||
{
|
||||
grpcRequest.UserId = request.UserId.Value;
|
||||
}
|
||||
|
||||
var response = await _context.Commissions.GetWithdrawalRequestsAsync(grpcRequest, cancellationToken: cancellationToken);
|
||||
|
||||
return response.Adapt<GetWithdrawalRequestsResponseDto>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWithdrawalRequests;
|
||||
|
||||
public record GetWithdrawalRequestsResponseDto
|
||||
{
|
||||
public List<WithdrawalRequestDto> Models { get; init; } = new();
|
||||
public MetaDataDto MetaData { get; init; } = new();
|
||||
}
|
||||
|
||||
public record WithdrawalRequestDto
|
||||
{
|
||||
public long Id { get; init; }
|
||||
public long UserId { get; init; }
|
||||
public string UserName { get; init; } = string.Empty;
|
||||
public string PhoneNumber { get; init; } = string.Empty;
|
||||
public long Amount { get; init; }
|
||||
public int Status { get; init; }
|
||||
public string Method { get; init; } = "Bank";
|
||||
public string? BankAccount { get; init; }
|
||||
public string? BankName { get; init; }
|
||||
public DateTime RequestDate { get; init; }
|
||||
public DateTime? ProcessedDate { get; init; }
|
||||
public string? AdminNote { get; init; }
|
||||
}
|
||||
|
||||
public record MetaDataDto
|
||||
{
|
||||
public int TotalCount { get; init; }
|
||||
public int PageSize { get; init; }
|
||||
public int CurrentPage { get; init; }
|
||||
public int TotalPages { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user