Skip to content

refactor(points): consolidate leaderboard endpoints and remove redundant today endpoint

Mukthanand Reddy M requested to merge refactor/points-api-cleanup into develop

Title

refactor(points): consolidate leaderboard endpoints and remove redundant today endpoint

Description

This merge request refactors the points API by consolidating the global and category leaderboard endpoints into a single /points/leaderboard endpoint.

The new endpoint supports:

  • Global leaderboard when no category_id query parameter is provided.
  • Category-specific leaderboard when category_id is provided.
  • Current user's rank when they are outside the top 10.

This also removes the separate /points/today endpoint and its response schema, since today's points are already available through /points/stats/{user_identifier} as points_today.

Notes

  • Leaderboards continue to use current calendar month-to-date points, not a rolling 30-day window.
  • Frontend active usage is not affected because current profile points data uses /points/stats/{user_identifier}.
  • Unused frontend helpers may be updated later when leaderboard UI work is implemented.

Checklist

  • Code has been refactored for clarity, maintainability, or performance.
  • No functional changes have been introduced.
  • All existing focused points tests are passing.
  • Code adheres to project coding standards.

Validation

Focused backend tests passed:

uv run pytest tests/unit/api/v1/endpoints/test_points_low_coverage.py tests/unit/api/v1/endpoints/test_points_coverage.py tests/app/schemas/test_points_schemas.py

Merge request reports

Loading