feat: cap leaderboard at 100 entries and add integration tests - #853
Open
crookdev11 wants to merge 1 commit into
Open
feat: cap leaderboard at 100 entries and add integration tests#853crookdev11 wants to merge 1 commit into
crookdev11 wants to merge 1 commit into
Conversation
- Add LEADERBOARD_MAX_ENTRIES (100) hard cap to httpGetCreatorLeaderboard - Parse and clamp optional ?limit param to [1, 100]; values above 100 are silently capped - Add total_count field to response so clients can detect truncation - Add integration test seeding 110 creators, asserting exactly 100 returned, top 100 by holder count, limit param capping, total_count - Update sort-order integration test to assert total_count field - Fix missing STELLAR_AUTH_SECRET in config schema (pre-existing) - Fix missing jwtAuth/httpGetWalletFollowing imports in wallets.routes.ts - Add ts-jest diagnostics warnOnly to unblock integration test runs
|
@crookdev11 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.
Cap leaderboard endpoint at 100 entries
The GET /api/v1/creators/leaderboard endpoint previously
returned every creator in the database with no upper bound.
This PR enforces a hard cap of 100 entries and adds a
total_count field so clients can tell whether the list was
truncated.
What changed
LEADERBOARD_MAX_ENTRIES = 100 cap to every response
[1, 100] — any value above 100 is silently reduced to 100
the full number of creators in the database regardless of the
effective limit
Response shape (before → after)
{
"success": true,
"data": {
}
}
Tests added
creator-leaderboard-cap.integration.test.ts seeds 110 mock
creators with distinct holder counts and verifies:
Pre-existing fixes (required to unblock integration test runs)
config.schema.ts
wallets.routes.ts
pre-existing type errors in unrelated modules don't prevent
test suites from running
closes #770