diff --git a/app/main.py b/app/main.py index cc59041..c0f0c92 100644 --- a/app/main.py +++ b/app/main.py @@ -6651,6 +6651,27 @@ async def broker_metrics(request: Request, days: int = 90): return {"series": series, "count": len(series), "days": max(1, min(int(days or 90), 730))} +@app.get("/broker/money-series") +@limiter.limit("30/minute") +async def broker_money_series(request: Request): + """Revenue / token-spend / OC-balance series, for the member dashboard. + + The same payload /admin/money-series serves the panel, through the broker for + the same reason /broker/metrics is: it is AGGREGATE and carries no member + identities — cumulative revenue, cumulative token spend, and the co-op's + Open Collective balance. The co-op's own finances are not private to + stewards here: the member dashboard charts them next to the other co-op + charts, from the shared chart definitions, so members and stewards see the + same picture. Hourly-cached (the OC queries are slow). + + The balance series exists only from the day the snapshots began (the OC API + exposes just the CURRENT balance) — a chart must render that as a gap, never + as a zero, which is what the shared renderer does. + """ + _verify_broker_secret(request) + return await _get_money_payload() + + @app.get("/broker/model-leaderboard") @limiter.limit("30/minute") async def broker_model_leaderboard(request: Request, days: int = 0):