From fc95dc0e74aa7f115392628f48830def3afda5ba Mon Sep 17 00:00:00 2001 From: minhd-vu Date: Mon, 26 Feb 2024 00:14:50 -0500 Subject: [PATCH] update wins --- app/api/kill/confirm/route.ts | 9 +++++++++ lib/party.ts | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/app/api/kill/confirm/route.ts b/app/api/kill/confirm/route.ts index 15974d3..6e0e73f 100644 --- a/app/api/kill/confirm/route.ts +++ b/app/api/kill/confirm/route.ts @@ -83,6 +83,15 @@ export async function POST() { winnerId: players[0].id, }, }); + + await prisma.user.update({ + where: { + id: players[0].id, + }, + data: { + wins: players[0].wins + 1, + }, + }); } return Response.json(null); diff --git a/lib/party.ts b/lib/party.ts index d37fd34..4c680eb 100644 --- a/lib/party.ts +++ b/lib/party.ts @@ -59,6 +59,15 @@ export async function removePlayer(email: string) { winnerId: players[0].id, }, }); + + await prisma.user.update({ + where: { + id: players[0].id, + }, + data: { + wins: players[0].wins + 1, + }, + }); } if (party.started) {