Initial commit: EduBox V2 platform

This commit is contained in:
root
2026-06-06 19:55:41 +00:00
commit 0a73a70820
69 changed files with 5634 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import { prisma } from "./prisma";
import bcrypt from "bcryptjs";
export async function hashPassword(password: string): Promise<string> {
return bcrypt.hash(password, 12);
}
export async function verifyPassword(password: string, hashed: string): Promise<boolean> {
return bcrypt.compare(password, hashed);
}
export function requireRole(user: { role: string }, ...allowed: string[]) {
if (!allowed.includes(user.role)) {
throw new Error("Forbidden");
}
}