fix(api): correct champion history and deduplicate stats builds

Apply participant and champion filters before pagination and exclude timeline payloads. Route result statistics through the durable outbox, reuse current fragments, and serialize projection effects without spending retries on contention.

Validated with 716 API tests, 32 isolated Redis integration tests, API typecheck and build, and lint on changed files.
This commit is contained in:
dahyeon committed 2026-11-09 18:40:51 +09:00
1 parent ef141a13d0
commit f2eec479d9
14 files changed
+704 -47

No files matched your search

@@ -22,6 +22,25 @@ export interface MatchStatsDeleteGuard {
export class MatchStatsRepository {
constructor(private readonly connectionService: ConnectionService) {}
public async hasCurrentCompetitionFragment(params: {
matchId: mongoose.Types.ObjectId;
sourceCompetitionId: mongoose.Types.ObjectId;
sourceRevision: number;
projectorVersion: number;
builderVersion: number;
}): Promise<boolean> {
const MatchStatsModel = await this.connectionService.getModel('matchStats');
return Boolean(
await MatchStatsModel.exists({
matchId: params.matchId,
sourceCompetitionId: params.sourceCompetitionId,
sourceRevision: { $gte: params.sourceRevision },
projectorVersion: { $gte: params.projectorVersion },
builderVersion: { $gte: params.builderVersion },
}).exec(),
);
}
public async upsert(
fragment: Omit<MatchStats, 'createdAt' | 'updatedAt'>,
): Promise<void> {