feat: Implement user enrollment interaction to assign a random class role and add new role configurations.
This commit is contained in:
@@ -64,5 +64,22 @@ export const classService = {
|
||||
return updatedClass;
|
||||
};
|
||||
return tx ? await execute(tx) : await DrizzleClient.transaction(execute);
|
||||
},
|
||||
|
||||
createClass: async (data: typeof classes.$inferInsert, tx?: any) => {
|
||||
const execute = async (txFn: any) => {
|
||||
const [newClass] = await txFn.insert(classes)
|
||||
.values(data)
|
||||
.returning();
|
||||
return newClass;
|
||||
};
|
||||
return tx ? await execute(tx) : await DrizzleClient.transaction(execute);
|
||||
},
|
||||
|
||||
deleteClass: async (id: bigint, tx?: any) => {
|
||||
const execute = async (txFn: any) => {
|
||||
await txFn.delete(classes).where(eq(classes.id, id));
|
||||
};
|
||||
return tx ? await execute(tx) : await DrizzleClient.transaction(execute);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user