This commit is contained in:
dahyeon committed 2026-05-02 02:59:33 -07:00
1 parent b152a5b0fa
commit 2379051196
32 files changed
+1682 -383

No files matched your search

@@ -98,10 +98,30 @@ export class MatchService {
obj.result.games = [...obj.result.games].sort(
(left, right) => left.gameNumber - right.gameNumber,
);
if (!obj.result.seriesResults?.length) {
obj.result.seriesResults = [
{
blueGroupIndex: 1,
redGroupIndex: 1,
blueScore: obj.result.blueScore ?? 0,
redScore: obj.result.redScore ?? 0,
winnerSide: obj.result.winnerSide,
},
];
}
}
return {
...obj,
gameCount: match.gameCount || DEFAULT_TOURNAMENT_GAME_COUNT,
gameMode: match.gameMode ?? 'pair',
participants: (obj.participants ?? []).map((participant) => ({
...participant,
excluded: participant.excluded ?? false,
})),
teams: (obj.teams ?? []).map((team) => ({
...team,
groupIndex: team.groupIndex ?? 1,
})),
tournamentCodes: await this.tournamentCodeService.buildSlots(match),
};
}
@@ -114,6 +134,14 @@ export class MatchService {
throw new BadRequestException('Match does not belong to this community.');
}
const previousStatus = match.status;
if (
previousStatus !== 'recruiting' &&
('maxParticipants' in params.patch || 'gameMode' in params.patch)
) {
throw new BadRequestException(
'maxParticipants and gameMode can only be changed while recruiting.',
);
}
match.set(params.patch);
if (
previousStatus !== 'recruiting' &&
@@ -183,6 +211,7 @@ export class MatchService {
tier: selectedTier,
preferredPositions: params.preferredPositions,
joinedAt: new Date(),
excluded: false,
});
await match.save();
return match;