feat(admin): plan statistics + node restart/close-ae actions
Build backend images / build content-svc (push) Failing after 1m22s
Build backend images / build file-svc (push) Failing after 3m8s
Build backend images / build gateway (push) Failing after 53s
Build backend images / build identity-svc (push) Failing after 57s
Build backend images / build notification-svc (push) Failing after 1m25s
Build backend images / build render-svc (push) Failing after 2m5s
Build backend images / build studio-svc (push) Failing after 3m59s

Final legacy-admin items:
- identity GET /v1/admin/plan-statistics (active/total users + revenue per plan
  from user_plans); surfaced as a breakdown table in /admin/stats
- NodesTable: wire Restart + Close-AE actions (backend already supported them) via
  new proxy routes; was only drain/release before

Full DivineGateWeb legacy-admin parity achieved.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-02 23:02:03 +03:30
parent 3091911260
commit 151970accd
9 changed files with 89 additions and 3 deletions
@@ -57,6 +57,23 @@ public class AdminService(IdentityDbContext db)
pays.Sum(p => p.AmountMinor), payingAllTime, daily);
}
// ── Plan statistics ──────────────────────────────────────────────────────
public async Task<List<PlanStatRow>> GetPlanStatisticsAsync(Guid tenantId)
{
var now = DateTime.UtcNow;
return await db.UserPlans
.Where(p => p.TenantId == tenantId)
.GroupBy(p => p.PlanName)
.Select(g => new PlanStatRow(
g.Key,
g.Count(),
g.Count(x => x.ExpiresAt > now && x.CancelledAt == null),
g.Sum(x => x.PriceMinorPaid)))
.OrderByDescending(r => r.RevenueMinor)
.ToListAsync();
}
// ── CRM notes / tags ────────────────────────────────────────────────────
public async Task<UserCrmResponse> GetUserCrmAsync(Guid userId)