Initial Falah Mobile rebuild — all 7 blocks complete
- Auth system (login/register/profile) - Nur AI chat with persona system - Souq marketplace with FLH economy - Forum community with Shariah moderation - Wallet & FLH top-up - Premium/Pro tier upgrade with Polar.sh - Halal Monitor with map & bookmarks - Home dashboard with daily verse & streaks - Health endpoints Next.js 16.2.7, Prisma v5 SQLite, JWT auth, Tailwind CSS v4
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
binaryTargets = ["native", "linux-musl", "debian-openssl-3.0.x"]
|
||||
}
|
||||
|
||||
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(5000)
|
||||
isPro Boolean @default(false)
|
||||
isPremium Boolean @default(false)
|
||||
experienceLevel String?
|
||||
madhab String?
|
||||
coachPersona String?
|
||||
preferredName String?
|
||||
coachingGoals String?
|
||||
lastCoachedAt DateTime?
|
||||
dailyMsgCount Int @default(0)
|
||||
dailyMsgResetAt DateTime?
|
||||
stripeCustomerId String?
|
||||
stripeSubscriptionId String?
|
||||
trialEndsAt 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?
|
||||
}
|
||||
|
||||
model HalalPlaceCache {
|
||||
id String @id @default(cuid())
|
||||
cacheKey String @unique
|
||||
data String
|
||||
expiresAt DateTime
|
||||
}
|
||||
Reference in New Issue
Block a user