generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } enum VerificationStatus { PENDING APPROVED REJECTED } model User { id String @id @default(cuid()) email String @unique passwordHash String name String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt blogs Blog[] reportages Reportage[] brands Brand[] } /// Shared categories for blog, reportage, and brand model Category { id String @id @default(cuid()) name String slug String @unique parentId String? parent Category? @relation("CategoryTree", fields: [parentId], references: [id], onDelete: SetNull) children Category[] @relation("CategoryTree") createdAt DateTime @default(now()) updatedAt DateTime @updatedAt blogs BlogCategory[] reportages ReportageCategory[] brands BrandCategory[] @@index([parentId]) } model Blog { id String @id @default(cuid()) title String slug String @unique abstract String? metaDescription String? content String @default("") imageUrl String? tags String[] @default([]) verificationStatus VerificationStatus @default(PENDING) authorId String author User @relation(fields: [authorId], references: [id], onDelete: Restrict) categories BlogCategory[] publishedAt DateTime? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@index([authorId]) @@index([verificationStatus]) } model BlogCategory { blogId String categoryId String blog Blog @relation(fields: [blogId], references: [id], onDelete: Cascade) category Category @relation(fields: [categoryId], references: [id], onDelete: Cascade) @@id([blogId, categoryId]) @@index([categoryId]) } model Reportage { id String @id @default(cuid()) title String slug String @unique businessOwner String abstract String? metaDescription String? content String @default("") imageUrl String? tags String[] @default([]) verificationStatus VerificationStatus @default(PENDING) authorId String author User @relation(fields: [authorId], references: [id], onDelete: Restrict) categories ReportageCategory[] publishedAt DateTime? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@index([authorId]) @@index([verificationStatus]) } model ReportageCategory { reportageId String categoryId String reportage Reportage @relation(fields: [reportageId], references: [id], onDelete: Cascade) category Category @relation(fields: [categoryId], references: [id], onDelete: Cascade) @@id([reportageId, categoryId]) @@index([categoryId]) } model Brand { id String @id @default(cuid()) title String slug String @unique abstract String? metaDescription String? content String @default("") imageUrl String? galleryUrls String[] @default([]) tags String[] @default([]) country String city String? address String? /// [{ type: "phone"|"email"|..., value: string }] contacts Json @default("[]") verificationStatus VerificationStatus @default(PENDING) authorId String author User @relation(fields: [authorId], references: [id], onDelete: Restrict) categories BrandCategory[] publishedAt DateTime? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@index([authorId]) @@index([verificationStatus]) @@index([country]) } model BrandCategory { brandId String categoryId String brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade) category Category @relation(fields: [categoryId], references: [id], onDelete: Cascade) @@id([brandId, categoryId]) @@index([categoryId]) }