421 lines
12 KiB
Plaintext
421 lines
12 KiB
Plaintext
generator client {
|
|
provider = "prisma-client"
|
|
output = "./generated/client"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
}
|
|
|
|
model Post {
|
|
id String @id @default(uuid())
|
|
title String
|
|
slug String @unique
|
|
excerpt String?
|
|
body String
|
|
status String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
translations PostTranslation[]
|
|
}
|
|
|
|
model PostTranslation {
|
|
id String @id @default(uuid())
|
|
postId String
|
|
locale String
|
|
title String
|
|
excerpt String?
|
|
body String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([postId, locale])
|
|
@@index([locale])
|
|
}
|
|
|
|
model User {
|
|
id String @id
|
|
name String
|
|
email String
|
|
username String? @unique
|
|
emailVerified Boolean @default(false)
|
|
image String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
role String @default("editor")
|
|
isBanned Boolean @default(false)
|
|
isSystem Boolean @default(false)
|
|
isHidden Boolean @default(false)
|
|
isProtected Boolean @default(false)
|
|
sessions Session[]
|
|
accounts Account[]
|
|
commissions Commission[] @relation("CommissionAssignee")
|
|
|
|
@@unique([email])
|
|
@@index([role])
|
|
@@map("user")
|
|
}
|
|
|
|
model Session {
|
|
id String @id
|
|
expiresAt DateTime
|
|
token String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
ipAddress String?
|
|
userAgent String?
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([token])
|
|
@@index([userId])
|
|
@@map("session")
|
|
}
|
|
|
|
model Account {
|
|
id String @id
|
|
accountId String
|
|
providerId String
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
accessToken String?
|
|
refreshToken String?
|
|
idToken String?
|
|
accessTokenExpiresAt DateTime?
|
|
refreshTokenExpiresAt DateTime?
|
|
scope String?
|
|
password String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([userId])
|
|
@@map("account")
|
|
}
|
|
|
|
model Verification {
|
|
id String @id
|
|
identifier String
|
|
value String
|
|
expiresAt DateTime
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([identifier])
|
|
@@map("verification")
|
|
}
|
|
|
|
model SystemSetting {
|
|
key String @id
|
|
value String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@map("system_setting")
|
|
}
|
|
|
|
model MediaAsset {
|
|
id String @id @default(uuid())
|
|
type String
|
|
title String
|
|
description String?
|
|
altText String?
|
|
source String?
|
|
copyright String?
|
|
author String?
|
|
licenseType String?
|
|
licenseUrl String?
|
|
usageContext String?
|
|
location String?
|
|
capturedAt DateTime?
|
|
tags String[]
|
|
storageKey String? @unique
|
|
mimeType String?
|
|
width Int?
|
|
height Int?
|
|
sizeBytes Int?
|
|
isPublished Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
artworkLinks ArtworkRendition[]
|
|
|
|
@@index([type])
|
|
@@index([isPublished])
|
|
}
|
|
|
|
model Artwork {
|
|
id String @id @default(uuid())
|
|
title String
|
|
slug String @unique
|
|
description String?
|
|
medium String?
|
|
dimensions String?
|
|
year Int?
|
|
framing String?
|
|
availability String?
|
|
priceAmountCents Int?
|
|
priceCurrency String?
|
|
isPriceVisible Boolean @default(false)
|
|
isPublished Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
renditions ArtworkRendition[]
|
|
galleryLinks ArtworkGallery[]
|
|
albumLinks ArtworkAlbum[]
|
|
categoryLinks ArtworkCategory[]
|
|
tagLinks ArtworkTag[]
|
|
|
|
@@index([isPublished])
|
|
}
|
|
|
|
model ArtworkRendition {
|
|
id String @id @default(uuid())
|
|
artworkId String
|
|
mediaAssetId String
|
|
slot String
|
|
width Int?
|
|
height Int?
|
|
isPrimary Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
artwork Artwork @relation(fields: [artworkId], references: [id], onDelete: Cascade)
|
|
mediaAsset MediaAsset @relation(fields: [mediaAssetId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([artworkId, slot])
|
|
@@index([mediaAssetId])
|
|
}
|
|
|
|
model Gallery {
|
|
id String @id @default(uuid())
|
|
name String
|
|
slug String @unique
|
|
description String?
|
|
sortOrder Int @default(0)
|
|
isVisible Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
artworkLinks ArtworkGallery[]
|
|
}
|
|
|
|
model Album {
|
|
id String @id @default(uuid())
|
|
name String
|
|
slug String @unique
|
|
description String?
|
|
sortOrder Int @default(0)
|
|
isVisible Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
artworkLinks ArtworkAlbum[]
|
|
}
|
|
|
|
model Category {
|
|
id String @id @default(uuid())
|
|
name String
|
|
slug String @unique
|
|
description String?
|
|
sortOrder Int @default(0)
|
|
isVisible Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
artworkLinks ArtworkCategory[]
|
|
}
|
|
|
|
model Tag {
|
|
id String @id @default(uuid())
|
|
name String
|
|
slug String @unique
|
|
description String?
|
|
sortOrder Int @default(0)
|
|
isVisible Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
artworkLinks ArtworkTag[]
|
|
}
|
|
|
|
model ArtworkGallery {
|
|
id String @id @default(uuid())
|
|
artworkId String
|
|
galleryId String
|
|
createdAt DateTime @default(now())
|
|
artwork Artwork @relation(fields: [artworkId], references: [id], onDelete: Cascade)
|
|
gallery Gallery @relation(fields: [galleryId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([artworkId, galleryId])
|
|
@@index([galleryId])
|
|
}
|
|
|
|
model ArtworkAlbum {
|
|
id String @id @default(uuid())
|
|
artworkId String
|
|
albumId String
|
|
createdAt DateTime @default(now())
|
|
artwork Artwork @relation(fields: [artworkId], references: [id], onDelete: Cascade)
|
|
album Album @relation(fields: [albumId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([artworkId, albumId])
|
|
@@index([albumId])
|
|
}
|
|
|
|
model ArtworkCategory {
|
|
id String @id @default(uuid())
|
|
artworkId String
|
|
categoryId String
|
|
createdAt DateTime @default(now())
|
|
artwork Artwork @relation(fields: [artworkId], references: [id], onDelete: Cascade)
|
|
category Category @relation(fields: [categoryId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([artworkId, categoryId])
|
|
@@index([categoryId])
|
|
}
|
|
|
|
model ArtworkTag {
|
|
id String @id @default(uuid())
|
|
artworkId String
|
|
tagId String
|
|
createdAt DateTime @default(now())
|
|
artwork Artwork @relation(fields: [artworkId], references: [id], onDelete: Cascade)
|
|
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([artworkId, tagId])
|
|
@@index([tagId])
|
|
}
|
|
|
|
model Page {
|
|
id String @id @default(uuid())
|
|
title String
|
|
slug String @unique
|
|
status String
|
|
summary String?
|
|
content String
|
|
seoTitle String?
|
|
seoDescription String?
|
|
publishedAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
navItems NavigationItem[]
|
|
translations PageTranslation[]
|
|
|
|
@@index([status])
|
|
}
|
|
|
|
model PageTranslation {
|
|
id String @id @default(uuid())
|
|
pageId String
|
|
locale String
|
|
title String
|
|
summary String?
|
|
content String
|
|
seoTitle String?
|
|
seoDescription String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
page Page @relation(fields: [pageId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([pageId, locale])
|
|
@@index([locale])
|
|
}
|
|
|
|
model NavigationMenu {
|
|
id String @id @default(uuid())
|
|
name String
|
|
slug String @unique
|
|
location String
|
|
isVisible Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
items NavigationItem[]
|
|
}
|
|
|
|
model NavigationItem {
|
|
id String @id @default(uuid())
|
|
menuId String
|
|
pageId String?
|
|
label String
|
|
href String?
|
|
parentId String?
|
|
sortOrder Int @default(0)
|
|
isVisible Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
menu NavigationMenu @relation(fields: [menuId], references: [id], onDelete: Cascade)
|
|
page Page? @relation(fields: [pageId], references: [id], onDelete: SetNull)
|
|
parent NavigationItem? @relation("NavigationItemParent", fields: [parentId], references: [id], onDelete: Cascade)
|
|
children NavigationItem[] @relation("NavigationItemParent")
|
|
translations NavigationItemTranslation[]
|
|
|
|
@@index([menuId])
|
|
@@index([pageId])
|
|
@@index([parentId])
|
|
@@unique([menuId, parentId, sortOrder, label])
|
|
}
|
|
|
|
model NavigationItemTranslation {
|
|
id String @id @default(uuid())
|
|
navigationItemId String
|
|
locale String
|
|
label String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
navigationItem NavigationItem @relation(fields: [navigationItemId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([navigationItemId, locale])
|
|
@@index([locale])
|
|
}
|
|
|
|
model Customer {
|
|
id String @id @default(uuid())
|
|
name String
|
|
email String?
|
|
phone String?
|
|
instagram String?
|
|
notes String?
|
|
isRecurring Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
commissions Commission[]
|
|
|
|
@@index([email])
|
|
@@index([isRecurring])
|
|
}
|
|
|
|
model Commission {
|
|
id String @id @default(uuid())
|
|
title String
|
|
description String?
|
|
status String
|
|
customerId String?
|
|
assignedUserId String?
|
|
linkedArtworkIds String[] @default([])
|
|
budgetMin Float?
|
|
budgetMax Float?
|
|
dueAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
customer Customer? @relation(fields: [customerId], references: [id], onDelete: SetNull)
|
|
assignedUser User? @relation("CommissionAssignee", fields: [assignedUserId], references: [id], onDelete: SetNull)
|
|
|
|
@@index([status])
|
|
@@index([customerId])
|
|
@@index([assignedUserId])
|
|
}
|
|
|
|
model Announcement {
|
|
id String @id @default(uuid())
|
|
title String
|
|
message String
|
|
placement String
|
|
targetLocales String[] @default([])
|
|
priority Int @default(100)
|
|
ctaLabel String?
|
|
ctaHref String?
|
|
startsAt DateTime?
|
|
endsAt DateTime?
|
|
isVisible Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([placement, isVisible])
|
|
@@index([priority])
|
|
}
|