Add response DTOs for withdrawal and club activation commands
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkHistory;
|
||||
|
||||
public record GetNetworkHistoryQuery : IRequest<GetNetworkHistoryResponseDto>
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه کاربر (اختیاری)
|
||||
/// </summary>
|
||||
public long? UserId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه والد (اختیاری)
|
||||
/// </summary>
|
||||
public long? ParentId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره صفحه (پیشفرض: 1)
|
||||
/// </summary>
|
||||
public int PageNumber { get; init; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// تعداد در هر صفحه (پیشفرض: 10)
|
||||
/// </summary>
|
||||
public int PageSize { get; init; } = 10;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using CMSMicroservice.Protobuf.Protos.NetworkMembership;
|
||||
|
||||
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkHistory;
|
||||
|
||||
public class GetNetworkHistoryQueryHandler : IRequestHandler<GetNetworkHistoryQuery, GetNetworkHistoryResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public GetNetworkHistoryQueryHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<GetNetworkHistoryResponseDto> Handle(GetNetworkHistoryQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var response = await _context.NetworkMemberships.GetNetworkMembershipHistoryAsync(
|
||||
request.Adapt<GetNetworkMembershipHistoryRequest>(),
|
||||
cancellationToken: cancellationToken);
|
||||
|
||||
return response.Adapt<GetNetworkHistoryResponseDto>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkHistory;
|
||||
|
||||
public class GetNetworkHistoryResponseDto
|
||||
{
|
||||
/// <summary>
|
||||
/// لیست تاریخچه تغییرات شبکه
|
||||
/// </summary>
|
||||
public List<NetworkHistoryDto> History { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// تعداد کل رکوردها
|
||||
/// </summary>
|
||||
public int TotalCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره صفحه فعلی
|
||||
/// </summary>
|
||||
public int PageNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد در هر صفحه
|
||||
/// </summary>
|
||||
public int PageSize { get; set; }
|
||||
}
|
||||
|
||||
public class NetworkHistoryDto
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه تاریخچه
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه کاربر
|
||||
/// </summary>
|
||||
public long UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه والد قبلی
|
||||
/// </summary>
|
||||
public long? OldParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه والد جدید
|
||||
/// </summary>
|
||||
public long? NewParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// موقعیت قبلی (0=Left, 1=Right)
|
||||
/// </summary>
|
||||
public int? OldNetworkLeg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// موقعیت جدید
|
||||
/// </summary>
|
||||
public int? NewNetworkLeg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// سطح قبلی
|
||||
/// </summary>
|
||||
public int? OldNetworkLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// سطح جدید
|
||||
/// </summary>
|
||||
public int? NewNetworkLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع عملیات
|
||||
/// </summary>
|
||||
public int Action { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// انجام دهنده عملیات
|
||||
/// </summary>
|
||||
public string PerformedBy { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// دلیل تغییر
|
||||
/// </summary>
|
||||
public string Reason { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ ایجاد
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetUserNetworkInfo;
|
||||
|
||||
public record GetUserNetworkInfoQuery : IRequest<GetUserNetworkInfoResponseDto>
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه کاربر
|
||||
/// </summary>
|
||||
public long UserId { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using CMSMicroservice.Protobuf.Protos.NetworkMembership;
|
||||
|
||||
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetUserNetworkInfo;
|
||||
|
||||
public class GetUserNetworkInfoQueryHandler : IRequestHandler<GetUserNetworkInfoQuery, GetUserNetworkInfoResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public GetUserNetworkInfoQueryHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<GetUserNetworkInfoResponseDto> Handle(GetUserNetworkInfoQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var response = await _context.NetworkMemberships.GetUserNetworkAsync(
|
||||
request.Adapt<GetUserNetworkRequest>(),
|
||||
cancellationToken: cancellationToken);
|
||||
|
||||
return response.Adapt<GetUserNetworkInfoResponseDto>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetUserNetworkInfo;
|
||||
|
||||
public class GetUserNetworkInfoResponseDto
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه عضویت شبکه
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه کاربر
|
||||
/// </summary>
|
||||
public long UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کاربر
|
||||
/// </summary>
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// شناسه والد در شبکه
|
||||
/// </summary>
|
||||
public long? ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام والد
|
||||
/// </summary>
|
||||
public string ParentName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// موقعیت در شبکه (0=Left, 1=Right)
|
||||
/// </summary>
|
||||
public int NetworkLeg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه فرزند چپ
|
||||
/// </summary>
|
||||
public long? LeftChildId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام فرزند چپ
|
||||
/// </summary>
|
||||
public string LeftChildName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// شناسه فرزند راست
|
||||
/// </summary>
|
||||
public long? RightChildId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام فرزند راست
|
||||
/// </summary>
|
||||
public string RightChildName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// سطح در شبکه
|
||||
/// </summary>
|
||||
public int NetworkLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کد معرف
|
||||
/// </summary>
|
||||
public string ReferralCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ عضویت در شبکه
|
||||
/// </summary>
|
||||
public DateTime JoinedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ ایجاد
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user