@msbci/form-server 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,25 +40,38 @@ model FormDefinition {
40
40
  isPublished Boolean @default(false)
41
41
  tenantId String?
42
42
  formTypeId String?
43
- scopeId String?
44
43
  metadata String? // JSON
45
44
  createdAt DateTime @default(now())
46
45
  updatedAt DateTime @updatedAt
47
46
  createdBy String?
48
47
  updatedBy String?
49
48
 
50
- formType FormType? @relation(fields: [formTypeId], references: [id])
51
- scope Scope? @relation(fields: [scopeId], references: [id])
49
+ formType FormType? @relation(fields: [formTypeId], references: [id])
50
+ scopes FormDefinitionScope[]
52
51
  pages FormPage[]
53
52
  submissions FormSubmission[]
54
53
 
55
54
  @@unique([code, version, tenantId])
56
55
  @@index([tenantId])
57
56
  @@index([formTypeId])
58
- @@index([scopeId])
59
57
  @@map("form_definitions")
60
58
  }
61
59
 
60
+ // Pivot table — one form can reference many scopes (priority = order).
61
+ model FormDefinitionScope {
62
+ formId String
63
+ scopeId String
64
+ order Int @default(0)
65
+
66
+ form FormDefinition @relation(fields: [formId], references: [id], onDelete: Cascade)
67
+ scope Scope @relation(fields: [scopeId], references: [id], onDelete: Cascade)
68
+
69
+ @@id([formId, scopeId])
70
+ @@index([formId, order])
71
+ @@index([scopeId])
72
+ @@map("form_definition_scopes")
73
+ }
74
+
62
75
  // ─── Form Page (navigation unit) ──────────────────────────
63
76
 
64
77
  model FormPage {
@@ -171,7 +184,7 @@ model Scope {
171
184
  createdBy String?
172
185
  updatedBy String?
173
186
 
174
- forms FormDefinition[]
187
+ forms FormDefinitionScope[]
175
188
  templates VariableTemplate[]
176
189
 
177
190
  @@unique([code, tenantId])