feat: 增加品牌工作空间与业务提供项模型

This commit is contained in:
que01 committed 2026-09-19 22:47:10 +08:00
1 parent 4f26dce212
commit 8795086ece
2 files changed
+266

No files matched your search

+109
View File
@@ -52,6 +52,12 @@ model BrandProfile {
customerUsers CustomerUser[]
tags Tag[]
trustContents TrustContent[]
templateInstallations BrandTemplateInstallation[]
modules BrandModule[]
fieldDefinitions BrandFieldDefinition[]
offerings Offering[]
inquiryForms InquiryForm[]
inquirySubmissions InquirySubmission[]
}
model Service {
@@ -72,10 +78,113 @@ model Service {
updatedAt DateTime @updatedAt
bookings Booking[]
bookingItems BookingItem[]
offeringId String?
offering Offering? @relation(fields: [offeringId], references: [id], onDelete: SetNull)
@@unique([brandId, name])
@@index([brandId, isEnabled, sortOrder])
}
model BrandTemplateInstallation {
id String @id @default(uuid())
brandId String
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
templateKey String
templateVersion String @default("1.0.0")
installedAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([brandId, templateKey])
@@index([brandId])
}
model BrandModule {
id String @id @default(uuid())
brandId String
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
type String
title String
isEnabled Boolean @default(true)
sortOrder Int @default(0)
source String @default("core")
config Json?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([brandId, isEnabled, sortOrder])
}
model BrandFieldDefinition {
id String @id @default(uuid())
brandId String
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
scope String
key String
label String
type String
required Boolean @default(false)
isVisible Boolean @default(true)
sortOrder Int @default(0)
source String @default("custom")
isOverridden Boolean @default(false)
options Json?
visibleWhen Json?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([brandId, scope, key])
@@index([brandId, scope, sortOrder])
}
model Offering {
id String @id @default(uuid())
brandId String
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
kind String @default("service")
name String
summary String?
description String?
coverUrl String?
priceText String?
priceAmount Int?
isEnabled Boolean @default(true)
sortOrder Int @default(0)
config Json?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
services Service[]
inquiryForms InquiryForm[]
@@unique([brandId, name])
@@index([brandId, isEnabled, sortOrder])
}
model InquiryForm {
id String @id @default(uuid())
brandId String
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
offeringId String?
offering Offering? @relation(fields: [offeringId], references: [id], onDelete: SetNull)
name String
version Int @default(1)
isEnabled Boolean @default(true)
fieldsSnapshot Json
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
submissions InquirySubmission[]
@@index([brandId, isEnabled])
}
model InquirySubmission {
id String @id @default(uuid())
brandId String
inquiryFormId String
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
inquiryForm InquiryForm @relation(fields: [inquiryFormId], references: [id], onDelete: Restrict)
formVersion Int
fieldsSnapshot Json
values Json
activeFields Json
createdAt DateTime @default(now())
@@index([brandId, createdAt])
@@index([inquiryFormId, formVersion])
}
model TrustContent {
id String @id @default(uuid())
brandId String