From e10ea1dfcd0e0f6ea217297cdc0aefcdab8aa711 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 05:28:39 +0000 Subject: [PATCH 1/2] Initial plan From 6a99251a5bf3c354ac7e03a7b725a097ae767d2b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 05:34:34 +0000 Subject: [PATCH 2/2] Expand pending transaction check to include partnerId in any role Co-authored-by: ghostleek <44336310+ghostleek@users.noreply.github.com> --- app/api/sessions/[id]/transactions/route.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/api/sessions/[id]/transactions/route.ts b/app/api/sessions/[id]/transactions/route.ts index 5830b1e..bd019f3 100644 --- a/app/api/sessions/[id]/transactions/route.ts +++ b/app/api/sessions/[id]/transactions/route.ts @@ -59,13 +59,17 @@ export async function POST(req: Request, { params }: { params: { id: string } }) return NextResponse.json({ error: 'One or both players have already traded' }, { status: 400 }); } - // Check for pending transactions + // Check for pending transactions involving either player in any role const pending = await sql` SELECT id FROM transactions - WHERE round_id = ${round.id} AND status = 'pending' AND (initiator_id = ${initiatorId} OR partner_id = ${initiatorId}) + WHERE round_id = ${round.id} AND status = 'pending' + AND ( + initiator_id = ${initiatorId} OR partner_id = ${initiatorId} + OR initiator_id = ${partnerId} OR partner_id = ${partnerId} + ) `; if (pending.length > 0) { - return NextResponse.json({ error: 'You already have a pending transaction' }, { status: 400 }); + return NextResponse.json({ error: 'One or both players already have a pending transaction' }, { status: 400 }); } const txs = await sql`