Skip to content

Commit

Permalink
Fix incorrect use of transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
gausie committed Jul 28, 2024
1 parent ae3d5fc commit 8c02121
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/oaf/src/commands/clan/skills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -134,7 +134,7 @@ async function parseOldLogs() {
return;
}

prisma.player.update({
tx.player.update({
where: { playerId },
data: {
kills: {
Expand Down

0 comments on commit 8c02121

Please sign in to comment.