feat: connect tournament views to APIs and recover archived stats
Remove development previews and complete hall of fame, match history, official results, and multi-kill API integration. Fix active match pagination and team-ready controls, preserve basic scoreboards, and recover statistics when Riot archives arrive. Use bounded in-process cache invalidation retries and add the Riot match lookup index migration with regression coverage.
This commit is contained in:
1 parent
20e1e6ec04
commit
0d7617e2d2
70 files changed
+3739
-1793
No files matched your search
@@ -1,4 +1,10 @@
|
||||
import { Controller, Get, Param, Query } from '@nestjs/common';
|
||||
import {
|
||||
BadRequestException,
|
||||
Controller,
|
||||
Get,
|
||||
Param,
|
||||
Query,
|
||||
} from '@nestjs/common';
|
||||
import mongoose from 'mongoose';
|
||||
import { AllowPublicAccess } from '../auth/allow-public-access.decorator';
|
||||
import { ParseObjectIdPipe } from '../common/parse-object-id.pipe';
|
||||
@@ -9,6 +15,15 @@ import type { CommunityStatsFilters } from './community-stats.types';
|
||||
export class CommunityStatsController {
|
||||
constructor(private readonly communityStatsService: CommunityStatsService) {}
|
||||
|
||||
@Get('internal-stats/seasons')
|
||||
@AllowPublicAccess()
|
||||
public getSeasons(
|
||||
@Param('communityId', ParseObjectIdPipe)
|
||||
communityId: mongoose.Types.ObjectId,
|
||||
) {
|
||||
return this.communityStatsService.getSeasons(communityId);
|
||||
}
|
||||
|
||||
@Get('internal-stats/matches')
|
||||
@AllowPublicAccess()
|
||||
public getMatches(
|
||||
@@ -20,7 +35,30 @@ export class CommunityStatsController {
|
||||
@Query('championId') championId?: string,
|
||||
@Query('cursor') cursor?: string,
|
||||
@Query('limit') limit?: string,
|
||||
@Query('q') query?: string,
|
||||
@Query('format') format?: string,
|
||||
@Query('playerId') playerId?: string,
|
||||
@Query('cursorMatchId') cursorMatchId?: string,
|
||||
) {
|
||||
if (format !== undefined && format !== 'pair' && format !== 'tournament') {
|
||||
throw new BadRequestException('Invalid format.');
|
||||
}
|
||||
if (playerId !== undefined && !mongoose.isObjectIdOrHexString(playerId)) {
|
||||
throw new BadRequestException('Invalid playerId.');
|
||||
}
|
||||
if (
|
||||
cursorMatchId !== undefined &&
|
||||
(!mongoose.isObjectIdOrHexString(cursorMatchId) ||
|
||||
this.toNumber(cursor) === undefined)
|
||||
) {
|
||||
throw new BadRequestException('Invalid cursor.');
|
||||
}
|
||||
if (
|
||||
cursor !== undefined &&
|
||||
Number.isNaN(new Date(this.toNumber(cursor) ?? NaN).getTime())
|
||||
) {
|
||||
throw new BadRequestException('Invalid cursor.');
|
||||
}
|
||||
return this.communityStatsService.getMatches({
|
||||
communityId,
|
||||
filters: this.toFilters({
|
||||
@@ -30,6 +68,10 @@ export class CommunityStatsController {
|
||||
championId,
|
||||
cursor,
|
||||
limit,
|
||||
query,
|
||||
format,
|
||||
playerId,
|
||||
cursorMatchId,
|
||||
}),
|
||||
});
|
||||
}
|
||||
@@ -43,10 +85,11 @@ export class CommunityStatsController {
|
||||
@Query('from') from?: string,
|
||||
@Query('to') to?: string,
|
||||
@Query('championId') championId?: string,
|
||||
@Query('q') query?: string,
|
||||
) {
|
||||
return this.communityStatsService.getLeaderboard({
|
||||
communityId,
|
||||
filters: this.toFilters({ seasonId, from, to, championId }),
|
||||
filters: this.toFilters({ seasonId, from, to, championId, query }),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -110,7 +153,17 @@ export class CommunityStatsController {
|
||||
championId?: string;
|
||||
cursor?: string;
|
||||
limit?: string;
|
||||
query?: string;
|
||||
format?: CommunityStatsFilters['format'];
|
||||
playerId?: string;
|
||||
cursorMatchId?: string;
|
||||
}): CommunityStatsFilters {
|
||||
if (
|
||||
params.query !== undefined &&
|
||||
(typeof params.query !== 'string' || params.query.length > 100)
|
||||
) {
|
||||
throw new BadRequestException('Invalid search query.');
|
||||
}
|
||||
return {
|
||||
seasonId: params.seasonId,
|
||||
from: params.from,
|
||||
@@ -118,6 +171,10 @@ export class CommunityStatsController {
|
||||
championId: this.toNumber(params.championId),
|
||||
cursor: this.toNumber(params.cursor),
|
||||
limit: this.toNumber(params.limit),
|
||||
query: params.query?.trim(),
|
||||
format: params.format,
|
||||
playerId: params.playerId,
|
||||
cursorMatchId: params.cursorMatchId,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user