feat(backend): implement user preferences on signup and public predictions list with unit tests#1215
Merged
Olowodarey merged 2 commits intoJun 24, 2026
Conversation
…tions list with unit tests
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@testersweb0-bug 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 of Changes
This PR addresses four assigned issues regarding automatic preference creation, short-circuit validation checks, public prediction lists, and leaderboard ordering switch tests.
1. Automatic UserPreferences Creation (#1087)
UserPreferencesrow when a new user signs up.UserPreferencestoTypeOrmModule.forFeatureinAuthModule.AuthService.verifySignature(), we check if the user is a newly created record and create/save a corresponding defaultUserPreferencesrecord.auth.service.spec.tsasserting both preference creation for new users and non-creation/idempotency for existing users.2. Predictions Short-Circuit Verification (#1088)
predictions.service.spec.tsverifying thatSorobanService.submitPredictionis never called when market validation fails (e.g., market is resolved, cancelled, expired, not found, or outcome is invalid).3. Public Route for Predictions by Market ID (#1094)
GET /predictions/market/:marketIdpublic route for anonymized, paginated prediction data.ListMarketPredictionsDtofor page/limit query validation.findByMarketonPredictionsService, mapping and returning paginated predictions with user details completely removed (anonymized). Returns an empty list if the market does not exist (not a 404).GET /predictions/market/:marketIdroute toPredictionsController.predictions.service.spec.ts.4. Leaderboard Order Switch Verification (#1089)
LeaderboardServicetests.leaderboard.service.spec.tsalready correctly test global sorting byreputation_scoreand seasonal sorting byseason_points, as well as validating that accuracy rate defaults to"0.0"whentotal_predictionsis0.Verification & Testing
Ran the following tests to verify correctness:
npm test src/auth/auth.service.spec.ts src/predictions/predictions.service.spec.ts src/leaderboard/leaderboard.service.spec.tsCloses #1089
Closes #1094
Closes #1088
Closes #1087