fix: fix potential issues with trivia command
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { users, userTimers, transactions } from "@db/schema";
|
||||
import { eq, and } from "drizzle-orm";
|
||||
import { eq, and, sql } from "drizzle-orm";
|
||||
import { config } from "@shared/lib/config";
|
||||
import { withTransaction } from "@/lib/db";
|
||||
import type { Transaction } from "@shared/lib/types";
|
||||
@@ -171,7 +171,7 @@ class TriviaService {
|
||||
// Deduct entry fee (SINK MECHANISM)
|
||||
await tx.update(users)
|
||||
.set({
|
||||
balance: (user.balance ?? 0n) - entryFee,
|
||||
balance: sql`${users.balance} - ${entryFee}`,
|
||||
})
|
||||
.where(eq(users.id, BigInt(userId)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user