From 9951048521debab75d69a2ff86e0568a5beb0588 Mon Sep 17 00:00:00 2001 From: Valentin Kaelin Date: Tue, 12 Aug 2025 22:10:58 +0200 Subject: [PATCH] fix: use new league endpoint by puuid --- server/app/Controllers/Http/SummonersController.ts | 2 +- server/app/Parsers/MatchPlayerRankParser.ts | 2 +- server/app/Serializers/LiveMatchSerializer.ts | 2 +- server/app/Services/Jax/src/Endpoints/LeagueEndpoint.ts | 7 +++---- server/app/Services/SummonerService.ts | 6 +++--- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/server/app/Controllers/Http/SummonersController.ts b/server/app/Controllers/Http/SummonersController.ts index d377aba..54ac5bc 100644 --- a/server/app/Controllers/Http/SummonersController.ts +++ b/server/app/Controllers/Http/SummonersController.ts @@ -49,7 +49,7 @@ export default class SummonersController { this.getSeasons(account.puuid), MatchRepository.gamemodes(account.puuid), Jax.Spectator.puuid(account.puuid, region), - SummonerService.getRanked(account.id, region), + SummonerService.getRanked(account.puuid, region), MatchRepository.recentActivity(account.puuid), // Only last 100 matchIds in matchlist MatchService.updateMatchList(account.puuid, region, MatchListMode.LIGHT), diff --git a/server/app/Parsers/MatchPlayerRankParser.ts b/server/app/Parsers/MatchPlayerRankParser.ts index 8a2115e..c142f9f 100644 --- a/server/app/Parsers/MatchPlayerRankParser.ts +++ b/server/app/Parsers/MatchPlayerRankParser.ts @@ -9,7 +9,7 @@ class MatchPlayerRankParser { public async parse(match: Match): Promise { const requests = match.players .filter((p) => p.summonerPuuid !== 'BOT') - .map((p) => SummonerService.getRanked(p.summonerId, match.region)) + .map((p) => SummonerService.getRanked(p.summonerPuuid, match.region)) const ranks = await Promise.all(requests) const parsedRanks = ranks diff --git a/server/app/Serializers/LiveMatchSerializer.ts b/server/app/Serializers/LiveMatchSerializer.ts index 0a6fbba..1892d4f 100644 --- a/server/app/Serializers/LiveMatchSerializer.ts +++ b/server/app/Serializers/LiveMatchSerializer.ts @@ -42,7 +42,7 @@ class LiveMatchSerializer extends MatchSerializer { // Ranks const requestsRanks = liveMatch.participants.map((p) => - SummonerService.getRanked(p.summonerId, region) + SummonerService.getRanked(p.puuid, region) ) const ranks = await Promise.all(requestsRanks) diff --git a/server/app/Services/Jax/src/Endpoints/LeagueEndpoint.ts b/server/app/Services/Jax/src/Endpoints/LeagueEndpoint.ts index c80fe80..1d1fda9 100644 --- a/server/app/Services/Jax/src/Endpoints/LeagueEndpoint.ts +++ b/server/app/Services/Jax/src/Endpoints/LeagueEndpoint.ts @@ -8,8 +8,7 @@ export interface LeagueEntryDTO { queueType: string tier: string rank: string - summonerId: string - summonerName: string + puuid: string leaguePoints: number wins: number losses: number @@ -36,11 +35,11 @@ export default class LeagueEndpoint { this.limiter = limiter } - public summonerID(summonerID: string, region: string): Promise { + public puuid(puuid: string, region: string): Promise { return new JaxRequest( region, this.config, - `league/v4/entries/by-summoner/${summonerID}`, + `league/v4/entries/by-puuid/${puuid}`, this.limiter, 300 ).execute() diff --git a/server/app/Services/SummonerService.ts b/server/app/Services/SummonerService.ts index 1d26b0e..817cb27 100644 --- a/server/app/Services/SummonerService.ts +++ b/server/app/Services/SummonerService.ts @@ -100,11 +100,11 @@ class SummonerService { /** * Get ranked data for a specific Summoner - * @param account + * @param puuid * @param region */ - public async getRanked(summonerId: string, region: string): Promise { - const ranked = await Jax.League.summonerID(summonerId, region) + public async getRanked(puuid: string, region: string): Promise { + const ranked = await Jax.League.puuid(puuid, region) const result: LeagueEntriesByQueue = {} if (ranked && ranked.length) {