await tx.player.update({
where: { user_id: state.player1_id },
select: { id: true },
data: {
gold: { increment: player_gold },
platinum: { decrement: attemptCost },
potions: {
updateMany: usedPotions.map((potion) => ({
where: {
potion_id: potion.potion.id,
player_id: state.player1_id,
},
data: {
quantity: potion.quantity,
},
})),
},
},
});
await tx.player.update({
where: { user_id: state.player1_id },
select: { id: true },
data: {
gold: { increment: player_gold },
platinum: { decrement: attemptCost },
potions: {
updateMany: usedPotions.map((potion) => ({
where: {
potion_id: potion.potion.id,
player_id: state.player1_id,
},
data: {
quantity: potion.quantity,
},
})),
},
},
});