From 8c02121d6066f859c630809a34e31c3ee77db0c3 Mon Sep 17 00:00:00 2001 From: Sam Gaus Date: Sun, 28 Jul 2024 13:55:24 +0100 Subject: [PATCH] Fix incorrect use of transaction --- packages/oaf/src/commands/clan/skills.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/oaf/src/commands/clan/skills.ts b/packages/oaf/src/commands/clan/skills.ts index 269b4de..e8f026b 100644 --- a/packages/oaf/src/commands/clan/skills.ts +++ b/packages/oaf/src/commands/clan/skills.ts @@ -111,19 +111,19 @@ async function parseOldLogs() { ); } - await prisma.$transaction(async () => { - await prisma.raid.createMany({ + await prisma.$transaction(async (tx) => { + await tx.raid.createMany({ data: raidsToParse.map((r) => ({ id: r })), skipDuplicates: true, }); for (const [playerId, { kills, skills }] of participation.entries()) { - const player = await prisma.player.findUnique({ where: { playerId } }); + const player = await tx.player.findUnique({ where: { playerId } }); if (!player) { const playerName = (await kolClient.players.fetch(playerId))?.name; if (!playerName) return; - prisma.player.create({ + tx.player.create({ data: { playerId, playerName, @@ -134,7 +134,7 @@ async function parseOldLogs() { return; } - prisma.player.update({ + tx.player.update({ where: { playerId }, data: { kills: {