Add response DTOs for withdrawal and club activation commands
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkTree;
|
||||
|
||||
public record GetNetworkTreeQuery : IRequest<GetNetworkTreeResponseDto>
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه کاربر ریشه (Root)
|
||||
/// </summary>
|
||||
public long RootUserId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// حداکثر عمق درخت (اختیاری، پیشفرض: 5)
|
||||
/// </summary>
|
||||
public int? MaxDepth { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// فقط کاربران فعال (اختیاری)
|
||||
/// </summary>
|
||||
public bool? OnlyActive { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using CMSMicroservice.Protobuf.Protos.NetworkMembership;
|
||||
|
||||
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkTree;
|
||||
|
||||
public class GetNetworkTreeQueryHandler : IRequestHandler<GetNetworkTreeQuery, GetNetworkTreeResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public GetNetworkTreeQueryHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<GetNetworkTreeResponseDto> Handle(GetNetworkTreeQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var response = await _context.NetworkMemberships.GetNetworkTreeAsync(
|
||||
request.Adapt<GetNetworkTreeRequest>(),
|
||||
cancellationToken: cancellationToken);
|
||||
|
||||
return response.Adapt<GetNetworkTreeResponseDto>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkTree;
|
||||
|
||||
public class GetNetworkTreeResponseDto
|
||||
{
|
||||
/// <summary>
|
||||
/// لیست گرههای درخت شبکه
|
||||
/// </summary>
|
||||
public List<NetworkTreeNodeDto> Nodes { get; set; } = new();
|
||||
}
|
||||
|
||||
public class NetworkTreeNodeDto
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه کاربر
|
||||
/// </summary>
|
||||
public long UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کاربر
|
||||
/// </summary>
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// شناسه والد
|
||||
/// </summary>
|
||||
public long? ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// موقعیت در شبکه (0=Left, 1=Right)
|
||||
/// </summary>
|
||||
public int NetworkLeg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// سطح در شبکه
|
||||
/// </summary>
|
||||
public int NetworkLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت فعال/غیرفعال
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ عضویت
|
||||
/// </summary>
|
||||
public DateTime JoinedAt { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user