feat: add tournament creation wizard with participant management and bulk game entry

This commit is contained in:
2026-03-29 19:58:15 -07:00
parent eb381d928c
commit 54fd6abb5e
10 changed files with 984 additions and 97 deletions
+17
View File
@@ -153,6 +153,23 @@ export async function POST(request: Request) {
await updatePartnershipStats(players[0].id, players[1].id, team1Won, player1EloChange);
await updatePartnershipStats(players[2].id, players[3].id, team2Won, player3EloChange);
// Add players as participants in the tournament (if not already added)
for (const player of players) {
try {
await prisma.eventParticipant.create({
data: {
eventId: parseInt(eventId),
playerId: player.id,
status: "participated",
registrationDate: new Date(),
},
});
} catch (error) {
// Participant already exists, which is fine
console.log(`Participant ${player.id} already exists in tournament ${eventId}`);
}
}
importedCount++;
} catch (err: any) {
errors.push(`Row ${index + 2}: ${err.message}`);