Files
afrov2/admin/prisma/schema.prisma
2026-04-11 23:30:14 +02:00

149 lines
3.5 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
}
enum UserRole {
VISITOR
ENTREPRENEUR
ADMIN
}
model User {
id String @id @default(uuid())
name String
email String @unique
password String
role UserRole @default(VISITOR)
avatar String?
businesses Business[]
comments Comment[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Business {
id String @id @default(uuid())
name String
slug String? @unique
category String
location String
description String @db.Text
logoUrl String
videoUrl String?
// Contact & Social
contactEmail String
contactPhone String?
// We use JSON to store social links (facebook, linkedin, instagram, website)
socialLinks Json?
// Stats
verified Boolean @default(false)
viewCount Int @default(0)
rating Float @default(0.0)
tags String[]
// Entrepreneur of the Month fields
isFeatured Boolean @default(false)
founderName String?
founderImageUrl String?
keyMetric String?
// Relations
ownerId String @unique
owner User @relation(fields: [ownerId], references: [id])
offers Offer[]
comments Comment[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
enum OfferType {
PRODUCT
SERVICE
}
model Offer {
id String @id @default(uuid())
title String
type OfferType
price Float
currency String @default("XOF") // EUR or XOF
description String? @db.Text
imageUrl String
active Boolean @default(true)
// Relations
businessId String
business Business @relation(fields: [businessId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model BlogPost {
id String @id @default(uuid())
title String
excerpt String @db.Text
content String @db.Text
author String
date DateTime @default(now())
imageUrl String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
enum InterviewType {
VIDEO
ARTICLE
}
model Interview {
id String @id @default(uuid())
title String
guestName String
companyName String
role String
type InterviewType
thumbnailUrl String
videoUrl String?
content String? @db.Text
excerpt String @db.Text
date DateTime @default(now())
duration String? // "15 min" ou "5 min de lecture"
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Comment {
id String @id @default(uuid())
content String @db.Text
// Relations
authorId String
author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
businessId String
business Business @relation(fields: [businessId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model AnalyticsEvent {
id String @id @default(uuid())
type String // PAGE_VIEW, CLICK, DWELL_TIME
path String
label String? // For clicks (button text, link name)
value Float? // For dwell time (seconds)
metadata Json? // Browser, OS, etc.
createdAt DateTime @default(now())
}