feat: Implement user enrollment interaction to assign a random class role and add new role configurations.

This commit is contained in:
syntaxbullet
2025-12-18 20:09:19 +01:00
parent a97a24f72a
commit 528a66a7ef
5 changed files with 124 additions and 1 deletions

View File

@@ -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);
}
};