feat: implement commission calculation strategy with ORM and SP options
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m43s

This commit is contained in:
masoodafar-web
2025-12-20 03:15:28 +03:30
parent 9864302bab
commit 25476ba120
18 changed files with 1687 additions and 21 deletions
@@ -56,16 +56,20 @@ public class GetNetworkStatisticsQueryHandler : IRequestHandler<GetNetworkStatis
// Monthly growth (last 6 months) - using Created date
var sixMonthsAgo = DateTime.Now.AddMonths(-6);
var monthlyGrowth = await _context.Users
var monthlyGrowthRaw = await _context.Users
.Where(x => x.NetworkParentId != null && x.Created >= sixMonthsAgo)
.GroupBy(x => new { x.Created.Year, x.Created.Month })
.Select(x => new { x.Created.Year, x.Created.Month })
.ToListAsync(cancellationToken);
var monthlyGrowth = monthlyGrowthRaw
.GroupBy(x => new { x.Year, x.Month })
.Select(g => new MonthlyGrowthModel
{
Month = $"{g.Key.Year}-{g.Key.Month:D2}",
NewMembers = g.Count()
})
.OrderBy(x => x.Month)
.ToListAsync(cancellationToken);
.ToList();
// Top users by total children count
var topUsers = await _context.Users