Add response DTOs for withdrawal and club activation commands

This commit is contained in:
masoodafar-web
2025-11-30 23:39:31 +03:30
parent 698c044be6
commit bfeb6456af
56 changed files with 3043 additions and 1 deletions
@@ -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; }
}