From d6a53f8912b248489295e2e554123fd1fcdefad7 Mon Sep 17 00:00:00 2001 From: David Gwilliam Date: Mon, 30 Mar 2026 22:58:01 -0700 Subject: [PATCH] feat: add targetScore and allowTies fields to tournament API routes --- src/app/api/tournaments/[id]/route.ts | 4 ++++ src/app/api/tournaments/route.ts | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/api/tournaments/[id]/route.ts b/src/app/api/tournaments/[id]/route.ts index e7cb42b..714881e 100644 --- a/src/app/api/tournaments/[id]/route.ts +++ b/src/app/api/tournaments/[id]/route.ts @@ -146,6 +146,8 @@ export async function PUT(request: Request, { params }: RouteParams) { status, maxParticipants, ownerId, + targetScore, + allowTies, } = body; // Validate required fields @@ -164,6 +166,8 @@ export async function PUT(request: Request, { params }: RouteParams) { eventType: eventType || "tournament", format: format || "round_robin", maxParticipants: maxParticipants ? parseInt(maxParticipants) : null, + targetScore: targetScore ? parseInt(targetScore) : null, + allowTies: allowTies ?? false, }; // Only allow status updates if they don't conflict with auto-calculation diff --git a/src/app/api/tournaments/route.ts b/src/app/api/tournaments/route.ts index 9e8d4d0..514da70 100644 --- a/src/app/api/tournaments/route.ts +++ b/src/app/api/tournaments/route.ts @@ -69,7 +69,7 @@ export async function POST(request: Request) { } const body = await request.json(); - const { name, format, eventDate } = body; + const { name, format, eventDate, targetScore, allowTies } = body; const tournament = await prisma.event.create({ data: { @@ -79,6 +79,8 @@ export async function POST(request: Request) { eventType: "tournament", status: "planned", ownerId: session.user.id, // Assign ownership to the creator + targetScore: targetScore ? parseInt(targetScore) : null, + allowTies: allowTies ?? false, }, });