feat: 实现小程序代码发布任务闭环
This commit is contained in:
1 parent
9b35b8e7a7
commit
526a9db789
14 files changed
+7242
-249
No files matched your search
+268
-220
@@ -1,5 +1,5 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
provider = "prisma-client-js"
|
||||
binaryTargets = ["linux-musl-openssl-3.0.x", "debian-openssl-3.0.x"]
|
||||
}
|
||||
|
||||
@@ -34,254 +34,298 @@ enum FulfillmentType {
|
||||
}
|
||||
|
||||
model BrandProfile {
|
||||
id String @id @default(uuid())
|
||||
slug String @unique @default("default-brand")
|
||||
name String
|
||||
templateKey String @default("food")
|
||||
tagline String?
|
||||
description String?
|
||||
avatarUrl String?
|
||||
coverUrl String?
|
||||
hours String?
|
||||
address String?
|
||||
deliveryNote String?
|
||||
contactPhone String?
|
||||
contactWechat String?
|
||||
config Json?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
bookings Booking[]
|
||||
customerUsers CustomerUser[]
|
||||
tags Tag[]
|
||||
trustContents TrustContent[]
|
||||
templateInstallations BrandTemplateInstallation[]
|
||||
fieldDefinitions BrandFieldDefinition[]
|
||||
offerings Offering[]
|
||||
inquiryForms InquiryForm[]
|
||||
inquirySubmissions InquirySubmission[]
|
||||
id String @id @default(uuid())
|
||||
slug String @unique @default("default-brand")
|
||||
name String
|
||||
templateKey String @default("food")
|
||||
tagline String?
|
||||
description String?
|
||||
avatarUrl String?
|
||||
coverUrl String?
|
||||
hours String?
|
||||
address String?
|
||||
deliveryNote String?
|
||||
contactPhone String?
|
||||
contactWechat String?
|
||||
config Json?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
bookings Booking[]
|
||||
customerUsers CustomerUser[]
|
||||
tags Tag[]
|
||||
trustContents TrustContent[]
|
||||
templateInstallations BrandTemplateInstallation[]
|
||||
fieldDefinitions BrandFieldDefinition[]
|
||||
offerings Offering[]
|
||||
inquiryForms InquiryForm[]
|
||||
inquirySubmissions InquirySubmission[]
|
||||
capabilityInstallations CapabilityInstallation[]
|
||||
capabilityAuditLogs CapabilityAuditLog[]
|
||||
adminMemberships BrandMembership[]
|
||||
releases BrandRelease[]
|
||||
capabilityAuditLogs CapabilityAuditLog[]
|
||||
adminMemberships BrandMembership[]
|
||||
releases BrandRelease[]
|
||||
miniAppReleases MiniAppReleaseTask[]
|
||||
}
|
||||
|
||||
model BrandRelease {
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
version Int
|
||||
status String @default("published")
|
||||
snapshot Json
|
||||
actorId String
|
||||
note String?
|
||||
createdAt DateTime @default(now())
|
||||
revokedAt DateTime?
|
||||
revokedBy String?
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
version Int
|
||||
status String @default("published")
|
||||
snapshot Json
|
||||
actorId String
|
||||
note String?
|
||||
createdAt DateTime @default(now())
|
||||
revokedAt DateTime?
|
||||
revokedBy String?
|
||||
miniAppReleases MiniAppReleaseTask[]
|
||||
|
||||
@@unique([brandId, version])
|
||||
@@index([brandId, status, createdAt])
|
||||
}
|
||||
|
||||
model CapabilityInstallation {
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
capabilityKey String
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
capabilityKey String
|
||||
capabilityVersion String
|
||||
status String @default("enabled")
|
||||
config Json?
|
||||
installedAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
status String @default("enabled")
|
||||
config Json?
|
||||
installedAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([brandId, capabilityKey])
|
||||
@@index([brandId, status])
|
||||
}
|
||||
|
||||
enum MiniAppReleaseStatus {
|
||||
built
|
||||
uploaded
|
||||
under_review
|
||||
rejected
|
||||
approved
|
||||
published
|
||||
failed
|
||||
}
|
||||
|
||||
model MiniAppReleaseTask {
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
releaseId String?
|
||||
release BrandRelease? @relation(fields: [releaseId], references: [id], onDelete: SetNull)
|
||||
version Int
|
||||
status MiniAppReleaseStatus @default(built)
|
||||
artifactPath String?
|
||||
actorId String
|
||||
error String?
|
||||
weappUploadId String?
|
||||
audit Json?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([brandId, version])
|
||||
@@index([brandId, createdAt])
|
||||
}
|
||||
|
||||
model CapabilityAuditLog {
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
capabilityKey String
|
||||
actorId String
|
||||
action String
|
||||
fromStatus String?
|
||||
toStatus String
|
||||
config Json?
|
||||
createdAt DateTime @default(now())
|
||||
actorId String
|
||||
action String
|
||||
fromStatus String?
|
||||
toStatus String
|
||||
config Json?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([brandId, capabilityKey, createdAt])
|
||||
}
|
||||
|
||||
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")
|
||||
configSnapshot Json
|
||||
previousSnapshots Json @default("[]")
|
||||
installedAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
templateKey String
|
||||
templateVersion String @default("1.0.0")
|
||||
configSnapshot Json
|
||||
previousSnapshots Json @default("[]")
|
||||
installedAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([brandId, templateKey])
|
||||
@@index([brandId])
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
inquiryForms InquiryForm[]
|
||||
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
|
||||
inquiryForms InquiryForm[]
|
||||
inquirySubmissions InquirySubmission[]
|
||||
bookings Booking[]
|
||||
bookingItems BookingItem[]
|
||||
bookings Booking[]
|
||||
bookingItems BookingItem[]
|
||||
|
||||
@@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
|
||||
purpose String @default("inquiry")
|
||||
targetType String @default("brand")
|
||||
submissionAction String @default("create-inquiry")
|
||||
version Int @default(1)
|
||||
isEnabled Boolean @default(true)
|
||||
fieldsSnapshot Json
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
submissions InquirySubmission[]
|
||||
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
|
||||
purpose String @default("inquiry")
|
||||
targetType String @default("brand")
|
||||
submissionAction String @default("create-inquiry")
|
||||
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
|
||||
offeringId String?
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
inquiryFormId String
|
||||
offeringId String?
|
||||
customerSubject String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
inquiryForm InquiryForm @relation(fields: [inquiryFormId], references: [id], onDelete: Restrict)
|
||||
offering Offering? @relation(fields: [offeringId], references: [id], onDelete: SetNull)
|
||||
formVersion Int
|
||||
fieldsSnapshot Json
|
||||
values Json
|
||||
activeFields Json
|
||||
status String @default("new")
|
||||
adminNote String?
|
||||
updatedAt DateTime @updatedAt
|
||||
statusHistory InquirySubmissionStatusHistory[]
|
||||
createdAt DateTime @default(now())
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
inquiryForm InquiryForm @relation(fields: [inquiryFormId], references: [id], onDelete: Restrict)
|
||||
offering Offering? @relation(fields: [offeringId], references: [id], onDelete: SetNull)
|
||||
formVersion Int
|
||||
fieldsSnapshot Json
|
||||
values Json
|
||||
activeFields Json
|
||||
status String @default("new")
|
||||
adminNote String?
|
||||
updatedAt DateTime @updatedAt
|
||||
statusHistory InquirySubmissionStatusHistory[]
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([brandId, createdAt])
|
||||
@@index([brandId, customerSubject, createdAt])
|
||||
@@index([inquiryFormId, formVersion])
|
||||
}
|
||||
|
||||
model InquirySubmissionStatusHistory {
|
||||
id String @id @default(uuid())
|
||||
id String @id @default(uuid())
|
||||
submissionId String
|
||||
submission InquirySubmission @relation(fields: [submissionId], references: [id], onDelete: Cascade)
|
||||
fromStatus String?
|
||||
toStatus String
|
||||
adminNote String?
|
||||
createdAt DateTime @default(now())
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([submissionId, createdAt])
|
||||
}
|
||||
|
||||
model TrustContent {
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
type String
|
||||
title String
|
||||
summary String?
|
||||
content String
|
||||
coverUrl String?
|
||||
sortOrder Int @default(0)
|
||||
isPublished Boolean @default(true)
|
||||
config Json?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
type String
|
||||
title String
|
||||
summary String?
|
||||
content String
|
||||
coverUrl String?
|
||||
sortOrder Int @default(0)
|
||||
isPublished Boolean @default(true)
|
||||
config Json?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([brandId, type, sortOrder])
|
||||
}
|
||||
|
||||
model CustomerUser {
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id])
|
||||
openid String
|
||||
lastLoginAt DateTime @default(now())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
bookings Booking[]
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id])
|
||||
openid String
|
||||
lastLoginAt DateTime @default(now())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
bookings Booking[]
|
||||
|
||||
@@unique([brandId, openid])
|
||||
}
|
||||
|
||||
model Booking {
|
||||
id String @id @default(uuid())
|
||||
bookingNo String @unique
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id])
|
||||
customerUserId String
|
||||
customerUser CustomerUser @relation(fields: [customerUserId], references: [id])
|
||||
requestType BookingRequestType
|
||||
customerName String
|
||||
phone String?
|
||||
wechatId String?
|
||||
contactPreference ContactPreference
|
||||
fulfillmentType FulfillmentType?
|
||||
offeringId String?
|
||||
offering Offering? @relation(fields: [offeringId], references: [id], onDelete: SetNull)
|
||||
requestedDate DateTime?
|
||||
requestedTime String?
|
||||
deliveryAddress String?
|
||||
estimatedAmount Int?
|
||||
extraData Json?
|
||||
note String?
|
||||
adminNote String?
|
||||
status BookingStatus @default(received)
|
||||
workflowKey String @default("booking.basic")
|
||||
workflowVersion String @default("1.0.0")
|
||||
currentState String @default("received")
|
||||
isRead Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
items BookingItem[]
|
||||
tags BookingTag[]
|
||||
stateTransitions BookingStateTransition[]
|
||||
id String @id @default(uuid())
|
||||
bookingNo String @unique
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id])
|
||||
customerUserId String
|
||||
customerUser CustomerUser @relation(fields: [customerUserId], references: [id])
|
||||
requestType BookingRequestType
|
||||
customerName String
|
||||
phone String?
|
||||
wechatId String?
|
||||
contactPreference ContactPreference
|
||||
fulfillmentType FulfillmentType?
|
||||
offeringId String?
|
||||
offering Offering? @relation(fields: [offeringId], references: [id], onDelete: SetNull)
|
||||
requestedDate DateTime?
|
||||
requestedTime String?
|
||||
deliveryAddress String?
|
||||
estimatedAmount Int?
|
||||
extraData Json?
|
||||
note String?
|
||||
adminNote String?
|
||||
status BookingStatus @default(received)
|
||||
workflowKey String @default("booking.basic")
|
||||
workflowVersion String @default("1.0.0")
|
||||
currentState String @default("received")
|
||||
isRead Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
items BookingItem[]
|
||||
tags BookingTag[]
|
||||
stateTransitions BookingStateTransition[]
|
||||
|
||||
@@index([brandId, status, createdAt])
|
||||
@@index([customerUserId, createdAt])
|
||||
}
|
||||
@@ -296,57 +340,60 @@ model BookingStateTransition {
|
||||
toState String
|
||||
actorRole String
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([bookingId, createdAt])
|
||||
}
|
||||
|
||||
model BookingItem {
|
||||
id String @id @default(uuid())
|
||||
bookingId String
|
||||
booking Booking @relation(fields: [bookingId], references: [id], onDelete: Cascade)
|
||||
offeringId String?
|
||||
offering Offering? @relation(fields: [offeringId], references: [id], onDelete: SetNull)
|
||||
id String @id @default(uuid())
|
||||
bookingId String
|
||||
booking Booking @relation(fields: [bookingId], references: [id], onDelete: Cascade)
|
||||
offeringId String?
|
||||
offering Offering? @relation(fields: [offeringId], references: [id], onDelete: SetNull)
|
||||
serviceNameSnapshot String
|
||||
unitPriceSnapshot Int
|
||||
quantity Int
|
||||
subtotalSnapshot Int
|
||||
unitPriceSnapshot Int
|
||||
quantity Int
|
||||
subtotalSnapshot Int
|
||||
}
|
||||
|
||||
model Tag {
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id])
|
||||
name String
|
||||
isPreset Boolean @default(false)
|
||||
isEnabled Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
bookings BookingTag[]
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id])
|
||||
name String
|
||||
isPreset Boolean @default(false)
|
||||
isEnabled Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
bookings BookingTag[]
|
||||
|
||||
@@unique([brandId, name])
|
||||
}
|
||||
|
||||
model AdminUser {
|
||||
id String @id @default(uuid())
|
||||
username String @unique
|
||||
passwordHash String
|
||||
displayName String
|
||||
role String @default("admin")
|
||||
isEnabled Boolean @default(true)
|
||||
mustChangePassword Boolean @default(false)
|
||||
lastLoginAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
memberships BrandMembership[]
|
||||
id String @id @default(uuid())
|
||||
username String @unique
|
||||
passwordHash String
|
||||
displayName String
|
||||
role String @default("admin")
|
||||
isEnabled Boolean @default(true)
|
||||
mustChangePassword Boolean @default(false)
|
||||
lastLoginAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
memberships BrandMembership[]
|
||||
}
|
||||
|
||||
model BrandMembership {
|
||||
id String @id @default(uuid())
|
||||
id String @id @default(uuid())
|
||||
adminUserId String
|
||||
brandId String
|
||||
role String @default("admin")
|
||||
isEnabled Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
adminUser AdminUser @relation(fields: [adminUserId], references: [id], onDelete: Cascade)
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
brandId String
|
||||
role String @default("admin")
|
||||
isEnabled Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
adminUser AdminUser @relation(fields: [adminUserId], references: [id], onDelete: Cascade)
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([adminUserId, brandId])
|
||||
@@index([brandId, isEnabled])
|
||||
}
|
||||
@@ -356,5 +403,6 @@ model BookingTag {
|
||||
tagId String
|
||||
booking Booking @relation(fields: [bookingId], references: [id], onDelete: Cascade)
|
||||
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@id([bookingId, tagId])
|
||||
}
|
||||
Reference in new issue
Block a user