russ_react_server/prisma/schema.prisma

69 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
avatarUrl String
bio String?
isAdmin Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
permissions Json
articles Article[]
order Int @default(0)
}
model Article {
id String @id @default(uuid())
importId Int @default(0)
title String
excerpt String
content String
categoryId Int
cityId Int
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[]
isActive Boolean @default(false)
}
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])
}