From 9af0604f475c34e89c898f77cce00139a5fe51c0 Mon Sep 17 00:00:00 2001 From: Inferencebot Date: Fri, 13 Nov 2026 21:01:38 +0000 Subject: [PATCH] portal: /broker/money-series, so members chart the co-op's money beside its other charts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The member dashboard could not show the money chart because the broker exposed no money series — the same payload /admin/money-series serves the panel is aggregate and carries no member identities (cumulative revenue, cumulative token spend, the OC balance), so it goes through the broker for the same reason /broker/metrics does. One chart definition, drawn identically for members and stewards. --- app/main.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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):