feat: predictions list per market#1305
Merged
Yunusabdul38 merged 2 commits intoJun 30, 2026
Merged
Conversation
Add cursor-paginated GET /api/v1/markets/:id/predictions endpoint. - db: MarketPredictionRow, get_market_predictions (id DESC, limit+1 trick for has-next detection), count_market_predictions - routes/v1: MarketPredictionsQuery + handler with 404 market guard, limit clamped 1-100, next_cursor derived from extra row - openapi: MarketPredictionDoc / MarketPredictionsResponse schemas + path stub - tests: 4 route-level tests (no-db guard, bad id 422, limit clamp, lazy-db wiring) + 5 pure-logic unit tests for cursor/clamp logic - docs: endpoint reference added to backend/README.md
|
@Bellamzy is attempting to deploy a commit to the shola's projects Team on Vercel. A member of the Team first needs to authorize it. |
Yunusabdul38
approved these changes
Jun 30, 2026
Yunusabdul38
left a comment
Collaborator
There was a problem hiding this comment.
LGTM
Thanks for your contribution
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.
feat: cursor-paginated predictions list per market
Summary
Adds GET /api/v1/markets/:id/predictions — a cursor-paginated endpoint that returns all
predictions placed in a specific market (pool), ordered newest-first.
Changes
backend/src/db.rs
without an extra COUNT
backend/src/routes/v1.rs
extra row
backend/src/openapi.rs
backend/README.md
Pagination
Pass next_cursor from the response as ?after= on the next request. A null cursor means
the last page has been reached.
GET /api/v1/markets/42/predictions?limit=20
GET /api/v1/markets/42/predictions?limit=20&after=302
Tests
wiring
Testing
cd backend
cargo test
closes #171