System boundaries
Gamification ind-sports-api is primarily implemented in:
server/quest-actions.tsserver/daily-quest-actions.tslib/leaderboard.tsapp/api/leaderboard/route.tsapp/api/rewards/*prisma/schema.prisma(gamification models)
Core models
QuestandQuestStep: quest definitions and ordered steps.UserQuestStatusandUserStepStatus: per-user quest and step progression.PointsHistory: append-only points ledger.LeaderboardandLeaderboardEntry: board membership and denormalized board points.LeaderboardSeason: season lifecycle metadata.RewardandUserReward: reward catalog and user claim state.
Cross-feature flow
Season 0.5 scoping rules
- New points writes include
seasonIdandleaderboardIdwhere determinable. - Team board scoring reads are scoped by both active season and board.
- Global board scoring reads are scoped by active season only.
- Legacy rows with null scope are intentionally preserved and treated as legacy data.
Important implementation notes
- Some flows still use fallback writes with
leaderboardId: nullwhen board context is unavailable. LeaderboardEntry.pointsremains present for compatibility and is planned for later cleanup.- Non-admin reset/archive lifecycle paths are intentionally not covered in this gamification section.
