forked from syntaxbullet/AuroraBot-discord
feat: Implement graphical student ID card generation for user profiles.
This commit is contained in:
@@ -25,7 +25,12 @@ export const classService = {
|
||||
};
|
||||
return tx ? await execute(tx) : await DrizzleClient.transaction(execute);
|
||||
},
|
||||
|
||||
getClassBalance: async (classId: bigint) => {
|
||||
const cls = await DrizzleClient.query.classes.findFirst({
|
||||
where: eq(classes.id, classId),
|
||||
});
|
||||
return cls?.balance || 0n;
|
||||
},
|
||||
modifyClassBalance: async (classId: bigint, amount: bigint, tx?: any) => {
|
||||
const execute = async (txFn: any) => {
|
||||
const cls = await txFn.query.classes.findFirst({
|
||||
|
||||
@@ -32,6 +32,13 @@ export const userService = {
|
||||
};
|
||||
return tx ? await execute(tx) : await DrizzleClient.transaction(execute);
|
||||
},
|
||||
getUserClass: async (id: string) => {
|
||||
const user = await DrizzleClient.query.users.findFirst({
|
||||
where: eq(users.id, BigInt(id)),
|
||||
with: { class: true }
|
||||
});
|
||||
return user?.class;
|
||||
},
|
||||
createUser: async (id: string | bigint, username: string, classId?: bigint, tx?: any) => {
|
||||
const execute = async (txFn: any) => {
|
||||
const [user] = await txFn.insert(users).values({
|
||||
|
||||
Reference in New Issue
Block a user