- 完整实现Apple HIG 2025设计系统 - 添加Modal弹窗组件(毛玻璃效果、流畅动画) - 添加FileUpload文件上传组件(拖拽、批量上传、进度显示) - 实现产品上传功能(支持DWG/GLB/GLTF文件) - 优化产品列表展示(可折叠的产品+SKU结构) - 实现Tab切换功能(3D模型管理、五金件、BOM、文档) - 修复主题系统hydration错误 - 优化按钮和间距,符合Apple设计规范 - 添加分享页面的Apple风格重设计 - 创建测试数据脚本
101 lines
2.5 KiB
Plaintext
101 lines
2.5 KiB
Plaintext
// 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"
|
||
}
|
||
|
||
datasource db {
|
||
provider = "postgresql"
|
||
url = env("DATABASE_URL")
|
||
}
|
||
|
||
// 产品
|
||
model Product {
|
||
id String @id @default(cuid())
|
||
name String
|
||
sku String @unique
|
||
category String
|
||
modelUrl String // glTF 模型 URL
|
||
thumbnailUrl String? // 缩略图
|
||
|
||
// 关联
|
||
assemblySteps AssemblyStep[]
|
||
panels Panel[]
|
||
shareLinks ShareLink[]
|
||
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
}
|
||
|
||
// 装配步骤 ⭐ 核心
|
||
model AssemblyStep {
|
||
id String @id @default(cuid())
|
||
productId String
|
||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||
|
||
order Int // 步骤顺序
|
||
title String // 步骤标题
|
||
description String? // 步骤说明
|
||
|
||
// 动画数据(JSON)
|
||
partIds String[] // 参与的部件 ID
|
||
transform Json // 目标变换 {position, rotation, scale}
|
||
duration Int // 动画时长(ms)
|
||
easing String // 缓动函数
|
||
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([productId, order])
|
||
}
|
||
|
||
// 板件(简化版)
|
||
model Panel {
|
||
id String @id @default(cuid())
|
||
productId String
|
||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||
|
||
code String // 编号
|
||
name String // 名称
|
||
gltfNodeName String // glTF 节点名
|
||
|
||
// 尺寸
|
||
length Float
|
||
width Float
|
||
thickness Float
|
||
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([productId])
|
||
}
|
||
|
||
// 分享链接 ⭐ 核心
|
||
model ShareLink {
|
||
id String @id @default(cuid())
|
||
productId String
|
||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||
|
||
token String @unique // 分享令牌
|
||
expiresAt DateTime? // 过期时间(可选)
|
||
viewCount Int @default(0) // 查看次数
|
||
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([token])
|
||
}
|
||
|
||
// 用户(简化版,后续扩展)
|
||
model User {
|
||
id String @id @default(cuid())
|
||
email String @unique
|
||
name String
|
||
password String
|
||
role String @default("user") // user, admin
|
||
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
}
|