feat: enhance WeeklyBalanceModel with carryover and new members fields; update mappings and response DTO
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m55s

This commit is contained in:
masoodafar-web
2025-12-28 23:57:26 +03:30
parent 0ed694f475
commit a8a3d246da
6 changed files with 42 additions and 8 deletions
@@ -35,17 +35,23 @@ public class GetMyWeeklyBalancesQueryHandler : IRequestHandler<GetMyWeeklyBalanc
var response = await _context.Commission.GetUserWeeklyBalancesAsync(cmsRequest, cancellationToken: cancellationToken);
// Map list of UserWeeklyBalanceModel to DTO
// Note: CMS proto uses LeftLegTotal/RightLegTotal (sum of NewMembers + Carryover)
var balances = response.Models.Select(b => new WeeklyBalanceItemDto
{
Id = b.Id,
WeekDefinitionId = b.WeekDefinitionId,
WeekLabel = b.WeekDisplayName,
LeftLegBalances = b.LeftLegBalances,
RightLegBalances = b.RightLegBalances,
LeftLegBalances = b.LeftLegTotal, // Changed from LeftLegBalances
RightLegBalances = b.RightLegTotal, // Changed from RightLegBalances
TotalBalances = b.TotalBalances,
WeeklyPoolContribution = b.WeeklyPoolContribution,
CalculatedAt = b.CalculatedAt?.ToDateTime(),
IsExpired = b.IsExpired
IsExpired = b.IsExpired,
// New fields for carryover info
LeftLegCarryover = b.LeftLegCarryover,
RightLegCarryover = b.RightLegCarryover,
LeftLegNewMembers = b.LeftLegNewMembers,
RightLegNewMembers = b.RightLegNewMembers
}).ToList();
// Calculate summary
@@ -89,4 +89,24 @@ public class WeeklyBalanceItemDto
/// تاریخ شمسی
/// </summary>
public string DatePersian { get; set; } = string.Empty;
/// <summary>
/// انتقالی پای چپ از هفته قبل
/// </summary>
public int LeftLegCarryover { get; set; }
/// <summary>
/// انتقالی پای راست از هفته قبل
/// </summary>
public int RightLegCarryover { get; set; }
/// <summary>
/// اعضای جدید پای چپ این هفته
/// </summary>
public int LeftLegNewMembers { get; set; }
/// <summary>
/// اعضای جدید پای راست این هفته
/// </summary>
public int RightLegNewMembers { get; set; }
}