feat: add prediction note, admin role update, trending markets & competition participants endpoints#496
Merged
Olowodarey merged 1 commit intoArena1X:mainfrom Mar 30, 2026
Conversation
…tition participants - Add PATCH /predictions/:id/note endpoint with ownership validation (Arena1X#443) - Add note field to Prediction entity with migration - Add PATCH /admin/users/:id/role endpoint with self-demotion prevention (Arena1X#403) - Log role changes for audit trail - Add GET /markets/trending endpoint with trending algorithm (Arena1X#431) - Calculate trending score from participant count, pool size, time to resolution - Add in-memory caching with 15-minute TTL - Add GET /competitions/:id/participants endpoint (Arena1X#424) - Include scores, rankings, and pagination support - Add comprehensive unit tests for all new features
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@Akanimoh12 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
This PR implements four new backend endpoints addressing multiple open issues:
Closes #443
Closes #403
Closes #431
Closes #424
Issue #443 — [Backend] Prediction History - Edit Prediction Note
Endpoint:
PATCH /predictions/:id/noteChanges:
notefield (text, nullable) to thePredictionentityUpdatePredictionNoteDtowith validation (string, max 1000 chars)updateNote()inPredictionsServicewith ownership validation — only the prediction owner can update their notePATCH :id/noteendpoint inPredictionsControllerwithParseUUIDPipenotefield inPredictionWithStatusinterface andenrichWithStatus()response1775000000000-AddPredictionNoteColumnAccess: Authenticated users (own predictions only)
Issue #403 — [Backend] Admin User Management - Update User Role
Endpoint:
PATCH /admin/users/:id/roleChanges:
UpdateUserRoleDtowith@IsEnum(Role)validation (user|admin)updateUserRole()inAdminServicewith:BadRequestExceptionif admin tries to change own role)AnalyticsService.logActivity()with previous/new role detailsPATCH users/:id/roleendpoint inAdminController(protected by@Roles(Role.Admin)guard)Access: Admin only
Validation: Cannot demote yourself
Issue #431 — [Backend] Market Discovery - Trending Markets
Endpoint:
GET /markets/trendingChanges:
TrendingMarketsQueryDtowith pagination support (page/limit, max 50)TrendingMarketItemandPaginatedTrendingMarketsResponseDTOsMarketsServicewith scoring based on::idparameterized routes to avoid path conflictsAccess: Public
Issue #424 — [Backend] Competition - Get Participants
Endpoint:
GET /competitions/:id/participantsChanges:
ListParticipantsQueryDtowith pagination support (page/limit, max 50)ParticipantItemandPaginatedParticipantsResponseDTOsgetParticipants()inCompetitionsServicewith:Userentity for username/address displayCompetitionParticipantentity toCompetitionsModuleimportsGET :id/participantsendpoint inCompetitionsController(Public)Access: Public
Testing
All existing and new tests pass:
Files Changed
prediction.entity.ts,predictions.controller.ts,predictions.service.ts,list-my-predictions.dto.ts,update-prediction-note.dto.ts,predictions.service.spec.tsadmin.controller.ts,admin.service.ts,update-user-role.dto.ts,admin.service.spec.tsmarkets.controller.ts,markets.service.ts,trending-markets.dto.ts,markets.service.spec.tscompetitions.controller.ts,competitions.service.ts,competitions.module.ts,list-participants.dto.ts,competitions.service.spec.ts1775000000000-AddPredictionNoteColumn.ts