Pending course, rest ready for launch
This commit is contained in:
122
prisma/seed.ts
122
prisma/seed.ts
@@ -93,6 +93,126 @@ async function main() {
|
||||
},
|
||||
})
|
||||
console.log(`📚 Created Course: ${course.slug}`)
|
||||
|
||||
const miniGames = [
|
||||
{
|
||||
slug: "translation",
|
||||
title: "Legal Translation Challenge",
|
||||
description: "Translate legal terms accurately in context.",
|
||||
difficulty: "BEGINNER",
|
||||
questions: [
|
||||
{
|
||||
prompt: "Spanish term: incumplimiento contractual",
|
||||
choices: ["Contractual compliance", "Breach of contract", "Contract interpretation", "Mutual assent"],
|
||||
answerIndex: 1,
|
||||
},
|
||||
{
|
||||
prompt: "Spanish term: medida cautelar",
|
||||
choices: ["Class action", "Summary judgment", "Injunctive relief", "Arbitration clause"],
|
||||
answerIndex: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
slug: "term-matching",
|
||||
title: "Term Matching Game",
|
||||
description: "Match legal terms with accurate definitions.",
|
||||
difficulty: "INTERMEDIATE",
|
||||
questions: [
|
||||
{
|
||||
prompt: "Match: consideration",
|
||||
choices: [
|
||||
"A legally binding command from the court",
|
||||
"A bargained-for exchange of value between parties",
|
||||
"A prior case that has no legal effect",
|
||||
"A statement made outside of court",
|
||||
],
|
||||
answerIndex: 1,
|
||||
},
|
||||
{
|
||||
prompt: "Match: injunction",
|
||||
choices: [
|
||||
"A court order requiring a party to do or stop doing something",
|
||||
"A clause that sets venue for disputes",
|
||||
"A witness statement under oath",
|
||||
"A mandatory arbitration waiver",
|
||||
],
|
||||
answerIndex: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
slug: "contract-clauses",
|
||||
title: "Contract Clause Practice",
|
||||
description: "Pick the best clause drafting option for each scenario.",
|
||||
difficulty: "ADVANCED",
|
||||
questions: [
|
||||
{
|
||||
prompt: "Choose the strongest force majeure clause element:",
|
||||
choices: [
|
||||
"No definition of triggering events",
|
||||
"Broad reference without notice obligations",
|
||||
"Defined events, notice timeline, and mitigation duty",
|
||||
"Automatic termination without limits",
|
||||
],
|
||||
answerIndex: 2,
|
||||
},
|
||||
{
|
||||
prompt: "Best limitation of liability drafting choice:",
|
||||
choices: [
|
||||
"Exclude all damages including willful misconduct",
|
||||
"Cap liability with carve-outs for fraud and gross negligence",
|
||||
"No cap and no exclusions",
|
||||
"Cap liability only for one party",
|
||||
],
|
||||
answerIndex: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
const prismaAny = prisma as unknown as {
|
||||
miniGame: {
|
||||
upsert: (args: object) => Promise<{ id: string }>
|
||||
}
|
||||
miniGameQuestion: {
|
||||
deleteMany: (args: object) => Promise<unknown>
|
||||
createMany: (args: object) => Promise<unknown>
|
||||
}
|
||||
}
|
||||
for (const game of miniGames) {
|
||||
const saved = await prismaAny.miniGame.upsert({
|
||||
where: { slug: game.slug },
|
||||
update: {
|
||||
title: game.title,
|
||||
description: game.description,
|
||||
difficulty: game.difficulty,
|
||||
isActive: true,
|
||||
},
|
||||
create: {
|
||||
slug: game.slug,
|
||||
title: game.title,
|
||||
description: game.description,
|
||||
difficulty: game.difficulty,
|
||||
isActive: true,
|
||||
},
|
||||
})
|
||||
|
||||
await prismaAny.miniGameQuestion.deleteMany({
|
||||
where: { miniGameId: saved.id },
|
||||
})
|
||||
|
||||
await prismaAny.miniGameQuestion.createMany({
|
||||
data: game.questions.map((q, index) => ({
|
||||
miniGameId: saved.id,
|
||||
prompt: q.prompt,
|
||||
choices: q.choices,
|
||||
answerIndex: q.answerIndex,
|
||||
orderIndex: index,
|
||||
})),
|
||||
})
|
||||
}
|
||||
console.log(`🧩 Seeded ${miniGames.length} mini-games`)
|
||||
|
||||
console.log('✅ Seed complete!')
|
||||
|
||||
@@ -104,4 +224,4 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user