feat(api): add meters-by-plan, ETag, total-shares, and bulk-allowlist endpoints#482
Merged
Dev-AdeTutu merged 6 commits intoJun 28, 2026
Merged
Conversation
|
@yosemite01 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements four new backend API features across the stats, meters, collaborators, and allowlist routes.
Closes #461 —
GET /api/stats/meters-by-planFile:
backend/src/routes/stats.tsAdded a new sub-route under
/api/statsthat groups all meters by their plan type and returns a breakdown with guaranteed zero counts for any plan type that has no meters. Response is cached for 30 seconds (matching the existing/api/statsTTL).Response shape:
{ "Daily": 12, "Weekly": 5, "Usage": 3, "total": 20 }Closes #462 — ETag support on
GET /api/meters/:idFiles:
backend/src/routes/meters.ts,backend/src/middleware/cache.tsetagFor(data)helper fromcache.tsthat produces a quoted SHA-1 hash of any JSON-serialisable value.cacheFor(5_000)middleware on the/:idhandler with explicit ETag logic: the handler now sets anETagresponse header and checks the incomingIf-None-Matchheader, returning304 Not Modified(no body) when the hashes match./:id/statushandler (missing}));) that prevented the file from compiling.Closes #463 —
GET /api/collaborators/total-sharesFile:
backend/src/routes/collaborators.tsAdded a lightweight read-only endpoint that sums all collaborator basis points from
get_all_sharesand returns the total alongside the remaining headroom to 10 000 bps. Response is cached for 5 seconds. Also added the missingrequireAdminKeyimport that was referenced but not imported in the existing POST and DELETE handlers.Response shape:
{ "total_basis_points": 7500, "remaining": 2500 }Closes #464 —
POST /api/allowlist/bulkFile:
backend/src/routes/allowlist.tsAdded a bulk-add endpoint at
POST /api/allowlist/bulkprotected byrequireAdminKey. It accepts{ addresses: string[] }(max 50 items), validates each entry as a valid Stellar Ed25519 public key, submits each individually viaadminInvoke, and returns per-address results allowing partial success. Also cleaned up the malformed duplicate router definition that existed in the original file.Response shape:
{ "results": [ { "address": "G...", "hash": "abc123..." }, { "address": "GBAD...", "error": "Invalid Stellar public key" } ] }Files changed
backend/src/routes/stats.tsGET /api/stats/meters-by-planroute + 30 s cachebackend/src/middleware/cache.tsetagFor()exportbackend/src/routes/meters.ts/:id, fixed/:id/statussyntax errorbackend/src/routes/collaborators.tsGET /total-sharesroute, added missingrequireAdminKeyimportbackend/src/routes/allowlist.tsPOST /bulkroute, cleaned up duplicate router definition🤖 Generated with Claude Code