mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 09:26:58 +01:00
minor fixes, add superloot cheer
This commit is contained in:
@@ -2,7 +2,7 @@ import db from "db/connection";
|
||||
import { timeouts, users } from "db/schema";
|
||||
import { itemarray, type inventory } from "items";
|
||||
import type User from "user";
|
||||
import { count, desc, eq, inArray, sql, ne, between, and, SQL } from "drizzle-orm";
|
||||
import { count, desc, eq, inArray, sql, ne, between, and, SQL, type InferInsertModel, type InferSelectModel } from "drizzle-orm";
|
||||
|
||||
/** Use this function to both ensure existance and to retreive data */
|
||||
export async function getUserRecord(user: User) {
|
||||
@@ -32,11 +32,9 @@ async function createUserRecord(user: User) {
|
||||
});
|
||||
};
|
||||
|
||||
export type balanceUpdate = { balance: number; };
|
||||
export type inventoryUpdate = { inventory: inventory; };
|
||||
type updateUser = balanceUpdate | inventoryUpdate;
|
||||
export type UserRecord = InferSelectModel<typeof users>;
|
||||
|
||||
export async function updateUserRecord(user: User, newData: updateUser) {
|
||||
export async function updateUserRecord(user: User, newData: UserRecord) {
|
||||
await db.update(users).set(newData).where(eq(users.id, parseInt(user.id)));
|
||||
return true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user