91 lines
2.3 KiB
Plaintext
91 lines
2.3 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
name String?
|
|
email String @unique
|
|
password String
|
|
role Role @default(ADMIN)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
organization Organization? @relation(fields: [organizationId], references: [id])
|
|
organizationId String?
|
|
}
|
|
|
|
enum Role {
|
|
SUPER_ADMIN
|
|
ADMIN
|
|
VIEWER
|
|
}
|
|
|
|
model Organization {
|
|
id String @id @default(cuid())
|
|
name String
|
|
cnpj String? @unique
|
|
logoUrl String?
|
|
primaryColor String @default("#2563eb")
|
|
subdomain String @unique
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
users User[]
|
|
documents Document[]
|
|
folders Folder[]
|
|
}
|
|
|
|
model Folder {
|
|
id String @id @default(cuid())
|
|
name String
|
|
description String?
|
|
color String @default("#6366f1")
|
|
imageUrl String? // Imagem de capa da pasta
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
isPublished Boolean @default(false)
|
|
publishedAt DateTime?
|
|
|
|
organization Organization @relation(fields: [organizationId], references: [id])
|
|
organizationId String
|
|
|
|
parentId String?
|
|
parent Folder? @relation("FolderToFolder", fields: [parentId], references: [id])
|
|
children Folder[] @relation("FolderToFolder")
|
|
|
|
documents Document[]
|
|
}
|
|
|
|
model Document {
|
|
id String @id @default(cuid())
|
|
title String
|
|
description String?
|
|
fileUrl String
|
|
fileName String
|
|
fileType String
|
|
fileSize Int @default(0)
|
|
|
|
isPublished Boolean @default(false)
|
|
isDownloadable Boolean @default(true)
|
|
|
|
viewCount Int @default(0)
|
|
downloadCount Int @default(0)
|
|
|
|
publishedAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
organization Organization @relation(fields: [organizationId], references: [id])
|
|
organizationId String
|
|
|
|
folder Folder? @relation(fields: [folderId], references: [id])
|
|
folderId String?
|
|
}
|