feat(gists): add POST /v1/gists/:id/report endpoint - #1057
Conversation
BigBen-7
left a comment
There was a problem hiding this comment.
Nice work, JoeX17 — the endpoint, throttling, 404 handling, and mock-mode support all look solid, and the tests are good.
There's a merge conflict against main in soroban.service.ts (GitHub shows this as CONFLICTING) — your reportGist method landed in the same spot where #1032 (merged after your branch was created) added isActive and listGistsByCell. It's a simple adjacency conflict, not a real logical clash — both sets of methods are independent and can coexist as-is. Could you rebase onto current main and keep both blocks (your reportGist/reportGistLive/scValToNumber alongside the existing isActive/listGistsByCell)? Should be a quick resolve.
Once it's rebased clean, this is good to merge.
44b1045 to
cc96615
Compare
BigBen-7
left a comment
There was a problem hiding this comment.
Rebase confirmed clean — no conflict markers, and reportGist/reportGistLive coexist cleanly alongside isActive/listGistsByCell from #1032, exactly as expected for a pure adjacency conflict.
Verified locally: npm run build clean, full suite 13 suites, 113 passed + 1 todo, 0 failures. CI is also green.
Approving and merging. Thanks, JoeX17.
|
Sorry for the back-and-forth — this is timing, not anything you did wrong: #1058 (event decoding) merged just a few minutes ago and changed This should be the last one — |
Add a throttled report endpoint that calls the GistRegistry contract's report_gist method and returns the new count. - SorobanService: add reportGist() with mock + live paths - GistsService: add report() with 404 on missing gist - GistsController: POST /:id/report, throttled at 5/min, Swagger docs - Unit tests: success + not-found cases Closes PinSpace-Org#1039
cc96615 to
dd0526c
Compare
BigBen-7
left a comment
There was a problem hiding this comment.
Confirmed fully rebased onto current main — no conflict markers, and git merge reports "already up to date." reportGist/reportGistLive coexist cleanly with #1058's updated getEventsSince(GistRegistryEvent[]).
Verified locally: npm run build clean, full suite 14 suites, 124 passed + 1 todo, 0 failures.
Approving and merging — thanks for sticking with the back-and-forth, JoeX17, that was entirely a sequencing issue on our end, not anything you did wrong.
Closes #1039
Summary
Adds a throttled
POST /v1/gists/:id/reportendpoint that calls the GistRegistry contract'sreport_gistmethod and returns the new report count. This lets the frontend report gists without talking to Soroban directly.Changes
SorobanService (
soroban.service.ts)reportGist(gistId)public method with mock + live pathsreportGistLive()private method — builds a transaction callingreport_gist, signs, submits, waits for confirmation, extracts the returnedu32countscValToNumber()helper for extracting numeric return valuesGistsService (
gists.service.ts)report(id)— validates the gist exists (404 if not), callssorobanService.reportGist(), returns{ count }GistsController (
gists.controller.ts)POST /:id/reportroute@ApiOperationand@ApiParamTests (
gists.service.spec.ts)report returns the on-chain report count when the gist existsreport throws NotFoundException when the gist does not existVerification
npx tsc --noEmit— cleannpx jest --testPathPattern=gists.service.spec— 12/12 pass@Throttle({ default: { limit: 5, ttl: 60000 } })){ count: 1, mock: true }for local dev without a funded key