Background
There is currently no points-based leaderboard. The closest things that
exist are:
getParticipants() in `creator-events.service.
Goal
Add a GET /creator-events/:id/leaderboard endpoint backed by the new
contract view (with a DB-cached fallback populated by Issue 6's
EventFinalized handler for finalized events), replacing the unused
winners-query.dto.ts / WinnerResponse model.
Tasks
ContractService (src/contract/contract.service.ts): add
- New entity
src/matches/entities/creator-event-leaderboard-entry.entity.ts
- Migration:
<timestamp>-CreateCreatorEventLeaderboardEntry.ts.
- Rewrite
src/creator-events/dto/leaderboard-query.dto.ts to match the
- New service method
getLeaderboard() in creator-events.service.ts:
- If
event.is_finalized (from the cached CreatorEvent row) → read
- Otherwise → call
contractService.getEventLeaderboard(eventId) (live),
- New endpoint in
creator-events.controller.ts:
Acceptance Criteria
Background
There is currently no points-based leaderboard. The closest things that
exist are:
getParticipants()in `creator-events.service.Goal
Add a
GET /creator-events/:id/leaderboardendpoint backed by the newcontract view (with a DB-cached fallback populated by Issue 6's
EventFinalizedhandler for finalized events), replacing the unusedwinners-query.dto.ts/WinnerResponsemodel.Tasks
ContractService(src/contract/contract.service.ts): addsrc/matches/entities/creator-event-leaderboard-entry.entity.ts<timestamp>-CreateCreatorEventLeaderboardEntry.ts.src/creator-events/dto/leaderboard-query.dto.tsto match thegetLeaderboard()increator-events.service.ts:event.is_finalized(from the cachedCreatorEventrow) → readcontractService.getEventLeaderboard(eventId)(live),creator-events.controller.ts:Acceptance Criteria
GET /creator-events/:id/leaderboard?page=1&limit=20returns awinners-query.dto.tsand allContractWinner/getEventWinners