Pending course, rest ready for launch

This commit is contained in:
Marcelo
2026-03-15 13:52:11 +00:00
parent be4ca2ed78
commit 62b3cfe467
77 changed files with 6450 additions and 868 deletions

View File

@@ -37,6 +37,12 @@ enum ExerciseType {
MATCHING
}
enum MiniGameDifficulty {
BEGINNER
INTERMEDIATE
ADVANCED
}
// --- MODELS ---
model Profile {
@@ -55,6 +61,8 @@ model Profile {
progress UserProgress[]
certificates Certificate[]
authoredCourses Course[] @relation("CourseAuthor") // Teachers own courses
miniGameAttempts MiniGameAttempt[]
recommendations StudyRecommendation[]
}
model Company {
@@ -94,7 +102,8 @@ model Course {
description Json // { "en": "...", "es": "..." }
level ProficiencyLevel @default(INTERMEDIATE)
tags String[]
learningOutcomes Json? // "What you will learn"; array of strings now, i18n object later
status ContentStatus @default(DRAFT)
price Decimal @default(0.00) // Price in MXN
@@ -111,6 +120,7 @@ model Course {
modules Module[]
certificates Certificate[]
enrollments Enrollment[]
recommendations StudyRecommendation[]
}
model Enrollment {
@@ -152,6 +162,7 @@ model Lesson {
slug String? // Optional for direct linking
orderIndex Int
videoUrl String?
youtubeUrl String?
estimatedDuration Int // Seconds
version Int @default(1)
isFreePreview Boolean @default(false) // Marketing hook
@@ -206,10 +217,72 @@ model Certificate {
userId String
courseId String
companyId String? // Captured for co-branding (Nullable for B2C)
certificateNumber String @unique
pdfVersion Int @default(1)
issuedAt DateTime @default(now())
metadataSnapshot Json // Burn the course name/version here
user Profile @relation(fields: [userId], references: [id])
course Course @relation(fields: [courseId], references: [id])
company Company? @relation(fields: [companyId], references: [id])
}
@@unique([userId, courseId])
}
model MiniGame {
id String @id @default(uuid())
slug String @unique
title String
description String
isActive Boolean @default(true)
difficulty MiniGameDifficulty @default(INTERMEDIATE)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
questions MiniGameQuestion[]
attempts MiniGameAttempt[]
}
model MiniGameQuestion {
id String @id @default(uuid())
miniGameId String
prompt String
choices String[]
answerIndex Int
orderIndex Int @default(0)
miniGame MiniGame @relation(fields: [miniGameId], references: [id], onDelete: Cascade)
@@index([miniGameId, orderIndex])
}
model MiniGameAttempt {
id String @id @default(uuid())
userId String
miniGameId String
scorePercent Int
correctCount Int
totalQuestions Int
startedAt DateTime @default(now())
completedAt DateTime @default(now())
user Profile @relation(fields: [userId], references: [id], onDelete: Cascade)
miniGame MiniGame @relation(fields: [miniGameId], references: [id], onDelete: Cascade)
@@index([userId, miniGameId, completedAt])
}
model StudyRecommendation {
id String @id @default(uuid())
userId String
courseId String
reason String
priority Int @default(0)
isActive Boolean @default(true)
createdAt DateTime @default(now())
user Profile @relation(fields: [userId], references: [id], onDelete: Cascade)
course Course @relation(fields: [courseId], references: [id], onDelete: Cascade)
@@index([userId, isActive, priority])
}