1f60f1c908
- Add Course and Module models to Prisma schema - Create seed-learn.json with Daily Fiqh for Beginners (5 modules) - Create seed-learn.js with Hermes patch (strip id/courseId from create) - Add /learn page with course listing - Add /learn/[courseSlug]/[moduleId] page with content + quiz - Quiz data stored as JSON string per module - Content rendered as markdown with Key Concept, Details, Reflection, Action Step sections TODO: - Add audio player component for listen toggle - Add progress tracking per user - Add actual quiz scoring/validation - Connect to TTS pipeline for audio generation
180 lines
4.8 KiB
Plaintext
180 lines
4.8 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
binaryTargets = ["native", "linux-musl"]
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
email String @unique
|
|
name String
|
|
passwordHash String?
|
|
flhBalance Int @default(0)
|
|
isPro Boolean @default(false)
|
|
isPremium Boolean @default(false)
|
|
experienceLevel String?
|
|
madhab String?
|
|
coachPersona String?
|
|
preferredName String?
|
|
coachingGoals String?
|
|
lastCoachedAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
|
|
listings Listing[]
|
|
purchases Purchase[] @relation("BuyerPurchases")
|
|
sales Purchase[] @relation("SellerPurchases")
|
|
cashouts CashoutRequest[]
|
|
halalBookmarks HalalBookmark[]
|
|
halalUsage HalalUsage?
|
|
forumThreads ForumThread[]
|
|
forumPosts ForumPost[]
|
|
chatHistory ChatHistory[]
|
|
}
|
|
|
|
model Listing {
|
|
id String @id @default(cuid())
|
|
title String
|
|
description String
|
|
category String
|
|
priceFlh Int
|
|
sellerId String
|
|
seller User @relation(fields: [sellerId], references: [id])
|
|
status String @default("active")
|
|
featured Boolean @default(false)
|
|
featuredUntil DateTime?
|
|
fileType String?
|
|
createdAt DateTime @default(now())
|
|
|
|
purchases Purchase[]
|
|
}
|
|
|
|
model Purchase {
|
|
id String @id @default(cuid())
|
|
listingId String
|
|
listing Listing @relation(fields: [listingId], references: [id])
|
|
buyerId String
|
|
buyer User @relation("BuyerPurchases", fields: [buyerId], references: [id])
|
|
sellerId String
|
|
seller User @relation("SellerPurchases", fields: [sellerId], references: [id])
|
|
amountFlh Int
|
|
platformFee Int
|
|
sellerPayout Int
|
|
autoConfirmAt DateTime
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model CashoutRequest {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id])
|
|
amountFlh Int
|
|
fiatAmount Float
|
|
status String @default("pending")
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model ForumCategory {
|
|
id String @id @default(cuid())
|
|
name String @unique
|
|
description String?
|
|
icon String?
|
|
order Int?
|
|
createdAt DateTime @default(now())
|
|
|
|
threads ForumThread[]
|
|
}
|
|
|
|
model ForumThread {
|
|
id String @id @default(cuid())
|
|
title String
|
|
content String
|
|
categoryId String
|
|
category ForumCategory @relation(fields: [categoryId], references: [id])
|
|
authorId String
|
|
author User @relation(fields: [authorId], references: [id])
|
|
pinned Boolean @default(false)
|
|
shariahStatus String @default("pending")
|
|
shariahFlags String?
|
|
createdAt DateTime @default(now())
|
|
|
|
posts ForumPost[]
|
|
}
|
|
|
|
model ForumPost {
|
|
id String @id @default(cuid())
|
|
content String
|
|
threadId String
|
|
thread ForumThread @relation(fields: [threadId], references: [id])
|
|
authorId String
|
|
author User @relation(fields: [authorId], references: [id])
|
|
shariahStatus String @default("pending")
|
|
shariahFlags String?
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model ChatHistory {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id])
|
|
role String
|
|
content String
|
|
metadata String?
|
|
createdAt DateTime @default(now())
|
|
|
|
@@index([userId])
|
|
}
|
|
|
|
model HalalBookmark {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id])
|
|
itemId String
|
|
itemType String
|
|
label String?
|
|
createdAt DateTime @default(now())
|
|
|
|
@@index([userId])
|
|
}
|
|
|
|
model HalalUsage {
|
|
userId String @id
|
|
user User @relation(fields: [userId], references: [id])
|
|
queriesUsed Int @default(0)
|
|
queriesLimit Int @default(100)
|
|
periodEnd DateTime?
|
|
}
|
|
|
|
// ── Micro-Learning (Learn Module) ──
|
|
|
|
model Course {
|
|
id String @id @default(cuid())
|
|
slug String @unique
|
|
title String
|
|
description String
|
|
difficulty String // beginner | intermediate | advanced
|
|
imageUrl String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
modules Module[]
|
|
}
|
|
|
|
model Module {
|
|
id String @id @default(cuid())
|
|
courseId String
|
|
course Course @relation(fields: [courseId], references: [id], onDelete: Cascade)
|
|
title String
|
|
description String
|
|
content String // markdown
|
|
videoUrl String?
|
|
order Int
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
quizData String? // JSON string: [{question, options:[], correctIndex}]
|
|
}
|