feat: add tournament type and team support to tournament APIs
Update tournament APIs to support: - tournamentType field (individual/team) - Team creation for team tournaments - Even number validation for team tournaments - Automatic pairing of consecutive players into teams
This commit is contained in:
@@ -69,7 +69,7 @@ export async function POST(request: Request) {
|
||||
}
|
||||
|
||||
const body = await request.json();
|
||||
const { name, format, eventDate, targetScore, allowTies } = body;
|
||||
const { name, format, eventDate, targetScore, allowTies, maxParticipants, tournamentType } = body;
|
||||
|
||||
const tournament = await prisma.event.create({
|
||||
data: {
|
||||
@@ -77,10 +77,13 @@ export async function POST(request: Request) {
|
||||
format: format || "round_robin",
|
||||
eventDate: eventDate ? new Date(eventDate) : null,
|
||||
eventType: "tournament",
|
||||
tournamentType: tournamentType || "individual",
|
||||
status: "planned",
|
||||
ownerId: session.user.id, // Assign ownership to the creator
|
||||
ownerId: session.user.id,
|
||||
targetScore: targetScore ? parseInt(targetScore) : null,
|
||||
allowTies: allowTies ?? false,
|
||||
maxParticipants: maxParticipants ? parseInt(maxParticipants) : null,
|
||||
description: body.description,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user