Skip to content

1090 feature request implement the friends leaderboard - #1111

Merged
CapoMK25 merged 18 commits into
devfrom
1090-feature-request-implement-the-friends-leaderboard
Nov 17, 2026
Merged

CapoMK25 merged 18 commits into
devfrom
1090-feature-request-implement-the-friends-leaderboard

Conversation

@tickBit

@tickBit tickBit commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Brief description

Implement the friends leaderboard endpoint defined in issue #1090 and align it with the production leaderboard API contract.

The endpoint returns the authenticated player and their current accepted friends ranked by accepted personal lifetime wins. Authentication supports both bearer tokens and the website access-token cookie.

Change list

  • Add authenticated GET /leaderboards/players/friends endpoint.
  • Support bearer-token and altzone_access_token cookie authentication.
  • Build the leaderboard population from current accepted friendships.
  • Always include the requesting player.
  • Exclude pending, blocked, removed, and deleted friends.
  • Preserve visibility of private profiles within accepted friendships.
  • Rank players by wins, score-reached time, and stable player ID.
  • Return the same player fields and pagination envelope as the global leaderboard.
  • Add compound friendship indexes for both participant directions.
  • Add a database migration for the new indexes.
  • Add service, controller, endpoint, authentication, privacy, pagination, ordering, and index tests.
  • Update doc/leaderboard-api.md with the implemented friends-leaderboard behavior.

Postman testing

From localhost:

{
    "data": {
        "leaderboard": {
            "entries": [
                {
                    "wins": 0,
                    "rank": 1,
                    "playerId": "69ef8b7332f46bd743f4c54e",
                    "nickname": "User ABC",
                    "avatar": null,
                    "clan": {
                        "clanId": "6a06dc34058c7fd326e2b30c",
                        "name": "backer",
                        "logo": {
                            "logoType": "Heart",
                            "pieceColors": [
                                "#FFFFFF"
                            ]
                        }
                    }
                }
            ],
            "ownRank": 1
        }
    },
    "metaData": {
        "dataKey": "leaderboard",
        "modelName": "Leaderboard",
        "dataType": "Object",
        "dataCount": 1
    },
    "paginationData": {
        "currentPage": 1,
        "limit": 20,
        "offset": 0,
        "itemCount": 1,
        "pageCount": 1
    }
}

@codecov-alt

codecov-alt Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.65517% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/leaderboard/leaderboard.service.ts 86.95% 3 Missing ⚠️
Files with missing lines Coverage Δ
src/friendship/friendship.service.ts 73.21% <100.00%> (+3.21%) ⬆️
src/leaderboard/leaderboard.service.ts 96.12% <86.95%> (-1.99%) ⬇️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tickBit

tickBit commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

The required migration has been run on the physical server

@CapoMK25 CapoMK25 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid work all around, approved!

@github-project-automation github-project-automation Bot moved this from Backlog to Done in Altzone-Server Nov 17, 2026
@CapoMK25
CapoMK25 merged commit b5361fd into dev Nov 17, 2026
5 checks passed
@CapoMK25
CapoMK25 deleted the 1090-feature-request-implement-the-friends-leaderboard branch November 17, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Feature request: Implement the friends leaderboard

2 participants