233 lines
6.9 KiB
Plaintext
233 lines
6.9 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
enum Role {
|
|
USER
|
|
ADMIN
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
email String @unique
|
|
username String @unique
|
|
password String
|
|
role Role @default(USER)
|
|
isActive Boolean @default(false)
|
|
canDownload Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
department String @default("")
|
|
dingtalkUserId String? @unique
|
|
loginType String @default("normal")
|
|
realName String?
|
|
phone String? @unique
|
|
avatar String?
|
|
managedDepartment String?
|
|
isSuperAdmin Boolean @default(false)
|
|
parentId String?
|
|
likes MaterialLike[]
|
|
materials Material[]
|
|
parent User? @relation("UserHierarchy", fields: [parentId], references: [id])
|
|
children User[] @relation("UserHierarchy")
|
|
|
|
@@map("users")
|
|
}
|
|
|
|
model UploadTemplate {
|
|
id String @id @default(uuid())
|
|
name String
|
|
description String?
|
|
status String @default("draft")
|
|
version Int @default(1)
|
|
fieldGroups String?
|
|
displayConfig String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
fields UploadField[]
|
|
materials Material[]
|
|
}
|
|
|
|
model UploadField {
|
|
id String @id @default(uuid())
|
|
templateId String
|
|
key String
|
|
label String
|
|
type String
|
|
required Boolean @default(false)
|
|
orderIndex Int @default(0)
|
|
layoutWidth String?
|
|
validations String?
|
|
optionsSource String?
|
|
optionsStatic String?
|
|
allowedExtensions String?
|
|
visibleOnHomeFilter Boolean @default(false)
|
|
isSearchable Boolean @default(false)
|
|
isReadOnly Boolean @default(false)
|
|
conditions String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
template UploadTemplate @relation(fields: [templateId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model FilterItem {
|
|
id String @id @default(uuid())
|
|
fieldKey String
|
|
label String
|
|
group String?
|
|
orderIndex Int @default(0)
|
|
multiSelect Boolean @default(false)
|
|
showOnHome Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model Material {
|
|
id String @id @default(uuid())
|
|
previewUrl String
|
|
productModel String
|
|
brandName String?
|
|
seriesName String?
|
|
skuCode String?
|
|
materialTexture String?
|
|
categoryName String
|
|
sceneName String
|
|
materialType String @default("3DMAX")
|
|
renderer String @default("CR")
|
|
renderTime String?
|
|
imageResolution String?
|
|
colorMode String?
|
|
authorName String
|
|
zipFileName String @default("")
|
|
zipFilePath String @default("")
|
|
zipFileSize BigInt @default(0)
|
|
downloadCount Int @default(0)
|
|
likeCount Int @default(0)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
userId String
|
|
displayImages String @default("")
|
|
platformName String @default("")
|
|
metadata String?
|
|
templateId String?
|
|
likes MaterialLike[]
|
|
template UploadTemplate? @relation(fields: [templateId], references: [id])
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([userId])
|
|
@@index([createdAt])
|
|
@@index([categoryName])
|
|
@@index([sceneName])
|
|
@@index([platformName])
|
|
@@index([materialType])
|
|
@@index([downloadCount])
|
|
@@index([likeCount])
|
|
@@map("materials")
|
|
}
|
|
|
|
model MaterialLike {
|
|
id String @id @default(uuid())
|
|
materialId String
|
|
userId String
|
|
createdAt DateTime @default(now())
|
|
material Material @relation(fields: [materialId], references: [id], onDelete: Cascade)
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([materialId, userId])
|
|
@@index([materialId])
|
|
@@index([userId])
|
|
@@map("material_likes")
|
|
}
|
|
|
|
model Category {
|
|
id String @id @default(uuid())
|
|
name String @unique
|
|
options String? // JSON array of options for dropdown
|
|
createdAt DateTime @default(now())
|
|
|
|
@@map("categories")
|
|
}
|
|
|
|
model Scene {
|
|
id String @id @default(uuid())
|
|
name String @unique
|
|
options String? // JSON array of options for dropdown
|
|
createdAt DateTime @default(now())
|
|
|
|
@@map("scenes")
|
|
}
|
|
|
|
model Platform {
|
|
id String @id @default(uuid())
|
|
name String @unique
|
|
options String? // JSON array of options for dropdown
|
|
createdAt DateTime @default(now())
|
|
|
|
@@map("platforms")
|
|
}
|
|
|
|
model SystemSettings {
|
|
id String @id @default(uuid())
|
|
headerBgColor String @default("#1f2937")
|
|
siteName String @default("由壹点3D素材")
|
|
updatedAt DateTime @updatedAt
|
|
createdAt DateTime @default(now())
|
|
headerLogoUrl String @default("http://s3.1080p.hk/shuzhou/2025/05/18/8ebadf0a7cc34eaea00e8619b8efb827.png")
|
|
loginLogoUrl String @default("http://s3.1080p.hk/shuzhou/2025/05/18/8ebadf0a7cc34eaea00e8619b8efb827.png")
|
|
s3AccessKey String @default("")
|
|
s3Bucket String @default("")
|
|
s3Endpoint String @default("")
|
|
s3PublicUrl String @default("")
|
|
s3Region String @default("us-east-1")
|
|
s3SecretKey String @default("")
|
|
enableRegistration Boolean @default(true)
|
|
enableUserActivation Boolean @default(false)
|
|
enableAiImageEdit Boolean @default(false)
|
|
enableTunnelService Boolean @default(false)
|
|
|
|
@@map("system_settings")
|
|
}
|
|
|
|
model Department {
|
|
id String @id @default(uuid())
|
|
name String @unique
|
|
createdAt DateTime @default(now())
|
|
|
|
@@map("departments")
|
|
}
|
|
|
|
model Danmaku {
|
|
id String @id @default(uuid())
|
|
content String
|
|
username String
|
|
userId String
|
|
createdAt DateTime @default(now())
|
|
|
|
@@index([createdAt])
|
|
@@map("danmakus")
|
|
}
|
|
|
|
model Invitation {
|
|
id String @id @default(uuid())
|
|
code String @unique
|
|
createdBy String
|
|
usedBy String?
|
|
usedAt DateTime?
|
|
expiresAt DateTime?
|
|
maxUses Int @default(1)
|
|
currentUses Int @default(0)
|
|
isActive Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([code])
|
|
@@index([createdBy])
|
|
@@map("invitations")
|
|
}
|