Files

68 lines
3.0 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
/// Marketplace listing only. Name, categories, and profile live in Meshkee.
model Business {
id BigInt @id @default(autoincrement())
meshkeeBusinessId BigInt @unique(map: "businesses_meshkee_business_id_unique") @map("meshkee_business_id")
slug String @unique(map: "businesses_slug_unique") @db.VarChar(100)
status String @default("draft") @db.VarChar(32)
isFeatured Boolean @default(false) @map("is_featured")
sortWeight Int @default(0) @map("sort_weight")
publishedAt DateTime? @map("published_at") @db.Timestamptz(6)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
@@index([status, isFeatured, sortWeight(sort: Desc)], map: "idx_businesses_status_featured")
@@map("businesses")
}
/// JSON settings for the public website (homepage media, etc.).
model WebsiteSetting {
key String @id
value Json
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
@@map("website_settings")
}
/// Categories for the IranBay website blog (superadmin).
model WebsiteBlogCategory {
id BigInt @id @default(autoincrement())
name String @db.VarChar(120)
nameFa String? @map("name_fa") @db.VarChar(120)
description String? @db.Text
parentId BigInt? @map("parent_id")
parent WebsiteBlogCategory? @relation("WebsiteBlogCategoryTree", fields: [parentId], references: [id], onDelete: Restrict)
children WebsiteBlogCategory[] @relation("WebsiteBlogCategoryTree")
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
posts WebsiteBlogPost[]
@@index([parentId], map: "idx_website_blog_categories_parent_id")
@@map("website_blog_categories")
}
/// Posts for the IranBay website blog (superadmin).
model WebsiteBlogPost {
id BigInt @id @default(autoincrement())
title String @db.VarChar(200)
abstract String? @db.Text
mainTextHtml String? @map("main_text_html") @db.Text
imageUrl String? @map("image_url") @db.Text
categoryId BigInt @map("category_id")
category WebsiteBlogCategory @relation(fields: [categoryId], references: [id], onDelete: Restrict)
tags String[] @default([])
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
@@index([createdAt(sort: Desc)], map: "idx_website_blog_posts_created_at")
@@index([categoryId], map: "idx_website_blog_posts_category_id")
@@map("website_blog_posts")
}