162 lines
3.8 KiB
Plaintext
162 lines
3.8 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
}
|
|
|
|
model AppConfig {
|
|
id String @id @default(cuid())
|
|
key String @unique
|
|
value String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
enum PortfolioSectionType {
|
|
RICH_TEXT
|
|
GALLERY
|
|
STATS
|
|
DELIVERABLES
|
|
LINK
|
|
}
|
|
|
|
enum PortfolioAssetKind {
|
|
IMAGE
|
|
DOCUMENT
|
|
}
|
|
|
|
enum MediaSource {
|
|
UPLOAD
|
|
EXTERNAL
|
|
}
|
|
|
|
enum MediaKind {
|
|
IMAGE
|
|
DOCUMENT
|
|
}
|
|
|
|
enum MediaUsageType {
|
|
PORTFOLIO_COVER
|
|
PORTFOLIO_SECTION
|
|
PORTFOLIO_ASSET
|
|
GENERIC
|
|
}
|
|
|
|
model Category {
|
|
id String @id @default(cuid())
|
|
slug String @unique
|
|
nameAr String
|
|
nameEn String
|
|
nameDe String
|
|
descriptionAr String
|
|
descriptionEn String
|
|
descriptionDe String
|
|
sortOrder Int @default(0)
|
|
isActive Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
projects PortfolioProject[]
|
|
}
|
|
|
|
model PortfolioProject {
|
|
id String @id @default(cuid())
|
|
categoryId String
|
|
slug String @unique
|
|
titleAr String
|
|
titleEn String
|
|
titleDe String
|
|
summaryAr String
|
|
summaryEn String
|
|
summaryDe String
|
|
clientName String
|
|
projectYear Int
|
|
serviceLabelAr String
|
|
serviceLabelEn String
|
|
serviceLabelDe String
|
|
previewUrl String?
|
|
coverImagePath String?
|
|
isFeatured Boolean @default(false)
|
|
isPublished Boolean @default(false)
|
|
publishedAt DateTime?
|
|
sortOrder Int @default(0)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
category Category @relation(fields: [categoryId], references: [id], onDelete: Restrict)
|
|
sections PortfolioSection[]
|
|
assets PortfolioAsset[]
|
|
|
|
@@index([categoryId, isPublished, sortOrder])
|
|
@@index([isPublished, sortOrder])
|
|
}
|
|
|
|
model PortfolioSection {
|
|
id String @id @default(cuid())
|
|
projectId String
|
|
type PortfolioSectionType
|
|
titleAr String
|
|
titleEn String
|
|
titleDe String
|
|
bodyAr String
|
|
bodyEn String
|
|
bodyDe String
|
|
imagePath String?
|
|
linkUrl String?
|
|
sortOrder Int @default(0)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
project PortfolioProject @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([projectId, sortOrder])
|
|
}
|
|
|
|
model PortfolioAsset {
|
|
id String @id @default(cuid())
|
|
projectId String
|
|
kind PortfolioAssetKind
|
|
filePath String
|
|
altAr String
|
|
altEn String
|
|
altDe String
|
|
sortOrder Int @default(0)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
project PortfolioProject @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([projectId, sortOrder])
|
|
}
|
|
|
|
model MediaAsset {
|
|
id String @id @default(cuid())
|
|
source MediaSource
|
|
kind MediaKind
|
|
url String
|
|
fileName String
|
|
label String
|
|
altText String?
|
|
mimeType String?
|
|
size Int?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
usages MediaUsage[]
|
|
|
|
@@index([kind, createdAt])
|
|
}
|
|
|
|
model MediaUsage {
|
|
id String @id @default(cuid())
|
|
assetId String
|
|
usageType MediaUsageType
|
|
entityType String
|
|
entityId String
|
|
fieldKey String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
asset MediaAsset @relation(fields: [assetId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([usageType, entityType, entityId, fieldKey])
|
|
@@index([assetId])
|
|
@@index([entityType, entityId])
|
|
}
|