-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_balance.ts
More file actions
35 lines (27 loc) · 1.02 KB
/
update_balance.ts
File metadata and controls
35 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { db } from "./server/db";
import { eq } from "drizzle-orm";
import { users } from "./shared/schema";
async function main() {
console.log("Updating wallet balance for sailormoon user...");
// Find sailormoon user
const [sailormoon] = await db.select().from(users).where(eq(users.username, "sailormoon"));
if (!sailormoon) {
console.error("User 'sailormoon' not found!");
return;
}
console.log(`Found user: ${sailormoon.username} (ID: ${sailormoon.id})`);
// Subtract 36000 from 20000 to get the new balance
const newBalance = 20000 - 36000;
console.log(`Setting new wallet balance: $${newBalance.toFixed(2)}`);
// Update wallet balance directly in the database
await db.update(users)
.set({
walletBalance: newBalance.toString(),
points: 3600 // 10% of investment amount as points
})
.where(eq(users.id, sailormoon.id));
console.log("Wallet balance and points updated successfully!");
}
main().catch(err => {
console.error("Error during update:", err);
});