71 lines
1.6 KiB
Plaintext
71 lines
1.6 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
email String @unique
|
|
password String
|
|
displayName String
|
|
isAdmin Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
permissions Json
|
|
articles Article[]
|
|
}
|
|
|
|
model Article {
|
|
id String @id @default(uuid())
|
|
title String
|
|
excerpt String
|
|
content String
|
|
category Category @relation(fields: [categoryId], references: [id])
|
|
categoryId Int
|
|
city String
|
|
coverImage String
|
|
readTime Int
|
|
likes Int @default(0)
|
|
dislikes Int @default(0)
|
|
publishedAt DateTime @default(now())
|
|
author User @relation(fields: [authorId], references: [id])
|
|
authorId String
|
|
gallery GalleryImage[]
|
|
}
|
|
|
|
model Category {
|
|
id Int @id
|
|
name String @unique
|
|
articles Article[]
|
|
}
|
|
|
|
model GalleryImage {
|
|
id String @id @default(uuid())
|
|
url String
|
|
caption String
|
|
alt String
|
|
width Int
|
|
height Int
|
|
size Int
|
|
format String
|
|
article Article @relation(fields: [articleId], references: [id], onDelete: Cascade)
|
|
articleId String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
order Int @default(0)
|
|
}
|
|
|
|
model UserReaction {
|
|
id String @id @default(uuid())
|
|
userId String
|
|
articleId String
|
|
reaction String // 'like' or 'dislike'
|
|
createdAt DateTime @default(now())
|
|
|
|
@@unique([userId, articleId])
|
|
}
|