Skip to content

refactor: consolidate points leaderboard endpoints and remove /today

Summary

  • Removed GET /points/today — strict subset of /points/stats/{user}, no unique value; points_today already present in stats response
  • Removed GET /points/leaderboard/global and GET /points/leaderboard/category/{category_id} — ~80% identical query logic
  • Added unified GET /points/leaderboard with optional ?category_id query param — omit for global leaderboard, provide to filter by category
  • Removed PointsTodayResponse schema — no longer referenced anywhere
  • Updated tests in test_points_schemas.py and test_points_coverage.py to remove PointsTodayResponse references
  • No changes to GET /points/stats/{user} or GET /points/streak

Test plan

  • GET /points/leaderboard → global top 10 with current_user_rank
  • GET /points/leaderboard?category_id=<id> → category-filtered top 10
  • GET /points/leaderboard/global404 Not Found
  • GET /points/leaderboard/category/<id>404 Not Found
  • GET /points/today404 Not Found
  • GET /points/stats/admin_user200 OK, no regression

Checklist

  • Code follows project API guidelines
  • Documentation is updated (OpenAPI docs reflect removed endpoints and new param)
  • Code adheres to project coding standards

Closes #124

Merge request reports

Loading