This commit is contained in:
@@ -4,6 +4,7 @@ import { users, exams, questions, knowledgePoints, examSubmissions, examQuestion
|
||||
import { createId } from "@paralleldrive/cuid2"
|
||||
import { faker } from "@faker-js/faker"
|
||||
import { eq } from "drizzle-orm"
|
||||
import { hash } from "bcryptjs"
|
||||
|
||||
/**
|
||||
* Seed Script for Next_Edu
|
||||
@@ -19,6 +20,7 @@ const DIFFICULTY = [1, 2, 3, 4, 5]
|
||||
|
||||
async function seed() {
|
||||
console.log("🌱 Starting seed process...")
|
||||
const passwordHash = await hash("123456", 10)
|
||||
|
||||
// 1. Create a Teacher User if not exists
|
||||
const teacherEmail = "teacher@example.com"
|
||||
@@ -36,6 +38,7 @@ async function seed() {
|
||||
email: teacherEmail,
|
||||
role: "teacher",
|
||||
image: "https://api.dicebear.com/7.x/avataaars/svg?seed=Teacher",
|
||||
password: passwordHash,
|
||||
})
|
||||
} else {
|
||||
teacherId = existingTeacher.id
|
||||
@@ -54,6 +57,7 @@ async function seed() {
|
||||
email: faker.internet.email(),
|
||||
role: "student",
|
||||
image: `https://api.dicebear.com/7.x/avataaars/svg?seed=${sId}`,
|
||||
password: passwordHash,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user