gongxiangp2/prisma/schema.prisma
chenpei 3b825883bb feat: 添加多类型素材支持和系统外观设置功能 (v2.4.0)
新增功能:
- 素材类型系统:支持3DMAX/PSD/AI/CAD/C4D/其他等多种类型
- 智能表单:渲染器选项仅在3DMAX类型时显示
- 类型标签:首页卡片显示素材类型标签(橙色)
- 系统外观设置:自定义导航栏颜色、LOGO和网站名称

数据库变更:
- 新增materialType字段到materials表
- 新增materialType索引优化查询
- 新增SystemSettings表存储系统设置

技术改进:
- 完整的TypeScript类型支持
- 前后端完整适配
- 修复Next.js配置弃用警告
- 添加完整的部署文档

文件变更:
- 修改: 上传/编辑组件支持素材类型
- 修改: API接口处理新字段
- 新增: 系统设置管理页面
- 新增: 系统设置API路由
- 新增: 数据库迁移文件
- 更新: 项目文档和部署指南
2025-10-26 09:58:40 +08:00

109 lines
3.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
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
materials Material[]
likes MaterialLike[]
@@map("users")
}
model Material {
id String @id @default(uuid())
previewUrl String // S3 URL for preview image
productModel String // SPU
categoryName String // 使用店铺
sceneName String // 场景类别
materialType String @default("3DMAX") // 素材类型:3DMAX/PSD/AI/CAD/C4D/其他
renderer String @default("CR") // 渲染器:CR/VR/其它(仅3DMAX使用)
authorName String // 作者花名
zipFileName String // 压缩包文件名
zipFilePath String // 本地压缩包路径
zipFileSize BigInt @default(0) // 压缩包文件大小(字节)
downloadCount Int @default(0) // 下载次数
likeCount Int @default(0) // 点赞次数
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
likes MaterialLike[]
@@map("materials")
@@index([userId])
@@index([createdAt])
@@index([categoryName])
@@index([sceneName])
@@index([materialType])
@@index([downloadCount])
@@index([likeCount])
}
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]) // 确保一个用户只能点赞一次
@@map("material_likes")
@@index([materialId])
@@index([userId])
}
model Category {
id String @id @default(uuid())
name String @unique // 使用店铺名称
createdAt DateTime @default(now())
@@map("categories")
}
model Scene {
id String @id @default(uuid())
name String @unique // 场景类别名称
createdAt DateTime @default(now())
@@map("scenes")
}
model SystemSettings {
id String @id @default(uuid())
headerBgColor String @default("#1f2937") // 顶部导航栏背景色
logoUrl String @default("http://s3.1080p.hk/shuzhou/2025/05/18/8ebadf0a7cc34eaea00e8619b8efb827.png") // LOGO URL
siteName String @default("由壹点3D素材") // 网站名称
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
@@map("system_settings")
}
enum Role {
USER
ADMIN
}