feat: Add GET /contests endpoint with pagination, filtering, and Redis caching#40
Merged
PoulavBhowmick03 merged 4 commits intoShonen-Labs:mainfrom Jun 4, 2025
Merged
Conversation
Contributor
Author
|
@PoulavBhowmick03 please review |
PoulavBhowmick03
approved these changes
Jun 3, 2025
Contributor
|
@simplicityf please fix the build errors |
Contributor
Author
|
@PoulavBhowmick03, I have resolve it. The test is not coming from my side Or did i break a code 🤔 |
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.
Description:
This PR implements the GET /contests endpoint with the following features:
- Pagination using page and limit query parameters
- Filtering by contest type and status
- 30-second Redis caching to reduce database load on repeated queries
This improves performance and allows more flexible querying of contest data.
Also wrote a test case:
GET /api/contests
- returns contests with default pagination (19 ms)
- returns cached results when available (1 ms)
- filters by sport (1 ms)
- filters by fee range (2 ms)
- handles pagination correctly (1 ms)
- returns 400 for invalid query parameters
- continues without cache on Redis errors
- returns 500 on database errors (1 ms)
- combines multiple filters correctly (1 ms)
(Note: All unit test passed)
Related issue: closes #10