Skip to content

feat(achievements): expose the gameplay catalog and a user's achievement record - #108

Merged
diangogav merged 4 commits into
mainfrom
feat/achievements-endpoints
Oct 11, 2026
Merged

diangogav merged 4 commits into
mainfrom
feat/achievements-endpoints

Conversation

@diangogav

Copy link
Copy Markdown
Owner

Stacked on #107; retarget to main once it merges. Read side for the achievements atlas page (design in evolution-card-game docs/architecture/achievements-atlas.md).

Summary

  • GET /api/v1/achievements: the gameplay catalog (code IS NOT NULL, not deleted) with each item's requirement derived from its code (rankedWins / rankedMatches / currentStreak / ladderFirstWin with target and ladder; null for an unknown code). Stable version hash, ETag and 304 on If-None-Match.
  • GET /api/v1/users/:userId/achievements: every award of the user with its awardId (repeated trophies stay distinct) plus lifetime progress computed from matches with the same eligibility as the game-server awarder (not annulled, not deleted, no season filter): rankedWins, rankedMatches, currentStreak (latest 200 rows walked until the first loss) and hasRankedWinByLadder for TCG, OCG, Edison, JTP and Genesys, resolved through the existing rank-group member patterns so a win on a dated TCG list counts for TCG. 200 with zero counters for a user without matches, 404 for an unknown user. Public like /users/:userId/stats.

Queries filter on anulled = false AND deleted_at IS NULL so they can use the partial index shipped in evolution-types#16.

Test plan

  • bun run lint
  • bun test (564 passed)
  • bun run build
  • On dev after the migration: GET /api/v1/achievements lists 13 items; GET /api/v1/users/<id>/achievements for a player with ranked history shows plausible lifetime counters

Base automatically changed from feat/achievement-code to main October 11, 2026 23:57
@diangogav diangogav self-assigned this Oct 11, 2026
@diangogav
diangogav merged commit d0a854a into main Oct 11, 2026
@diangogav
diangogav deleted the feat/achievements-endpoints branch October 11, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant