@adaptware/eagles-db 0.6.9 → 0.6.10

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptware/eagles-db",
3
- "version": "0.6.9",
3
+ "version": "0.6.10",
4
4
  "description": "A Prisma client package for Treadspace database operations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
Binary file
Binary file
@@ -9,9 +9,9 @@ enum ConsentType {
9
9
  @@schema("public")
10
10
  }
11
11
 
12
- enum ConsentReferenceType {
13
- INTERVIEW
14
- ASSESSMENT
12
+ enum ConsentGrantStatus {
13
+ GRANTED
14
+ DECLINED
15
15
 
16
16
  @@schema("public")
17
17
  }
@@ -23,6 +23,13 @@ enum ConsentOutcome {
23
23
  @@schema("public")
24
24
  }
25
25
 
26
+ enum ConsentReferenceType {
27
+ INTERVIEW
28
+ ASSESSMENT
29
+
30
+ @@schema("public")
31
+ }
32
+
26
33
  enum ConsentCatalogVersionStatus {
27
34
  DRAFT
28
35
  PUBLISHED
@@ -76,22 +83,32 @@ model ConsentDocument {
76
83
 
77
84
  /// One immutable markdown object per version; S3 location and hash live on the linked Document.
78
85
  model ConsentDocumentVersion {
79
- id String @id @default(uuid())
80
- consent_document_id String
81
- consent_document ConsentDocument @relation(fields: [consent_document_id], references: [id], onDelete: Cascade)
82
- version_number Int
83
- document_id String?
84
- document Document? @relation(fields: [document_id], references: [id], onDelete: Restrict)
85
- status ConsentCatalogVersionStatus @default(DRAFT)
86
- published_at DateTime?
87
- created_at DateTime @default(now())
88
- updated_at DateTime @updatedAt
89
- checkboxes ConsentCheckboxDefinition[]
90
- consent_records ConsentRecord[]
86
+ id String @id @default(uuid())
87
+ consent_document_id String
88
+ consent_document ConsentDocument @relation(fields: [consent_document_id], references: [id], onDelete: Cascade)
89
+ version_number Int
90
+
91
+ // Dual document linkage for Platform Terms & Privacy Policy
92
+ document_id String?
93
+ document Document? @relation("TermsDocument", fields: [document_id], references: [id], onDelete: Restrict)
94
+ privacy_policy_id String?
95
+ privacy_policy Document? @relation("PrivacyPolicyDocument", fields: [privacy_policy_id], references: [id], onDelete: Restrict)
96
+
97
+ status ConsentCatalogVersionStatus @default(DRAFT)
98
+ published_at DateTime?
99
+ created_at DateTime @default(now())
100
+ updated_at DateTime @updatedAt
101
+
102
+ // Embedded checkboxes JSON array (ConsentCheckboxDefinition preserved in schema to prevent drop)
103
+ checkboxes Json? @default("[]")
104
+ checkbox_definitions ConsentCheckboxDefinition[]
105
+
106
+ consent_records ConsentRecord[]
91
107
 
92
108
  @@unique([consent_document_id, version_number])
93
109
  @@index([consent_document_id, status, version_number(sort: Desc)])
94
110
  @@index([document_id])
111
+ @@index([privacy_policy_id])
95
112
  @@schema("public")
96
113
  }
97
114
 
@@ -114,12 +131,20 @@ model ConsentRecord {
114
131
  id String @id @default(uuid())
115
132
  user_id String
116
133
  user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
117
- outcome ConsentOutcome
134
+
135
+ // Dual-existence for non-breaking migration
136
+ outcome ConsentOutcome?
137
+ grant_status ConsentGrantStatus?
138
+
118
139
  consent_document_version_id String
119
140
  consent_document_version ConsentDocumentVersion @relation(fields: [consent_document_version_id], references: [id], onDelete: Restrict)
120
141
  selections Json @default("{}")
142
+
143
+ // Dual-existence for non-breaking migration
121
144
  reference_type ConsentReferenceType?
122
145
  reference_id String?
146
+ evaluation_id String?
147
+
123
148
  ip_address String?
124
149
  user_agent String?
125
150
  decline_reason String?
@@ -127,6 +152,7 @@ model ConsentRecord {
127
152
 
128
153
  @@index([user_id, created_at(sort: Desc)])
129
154
  @@index([reference_type, reference_id, created_at(sort: Desc)])
155
+ @@index([evaluation_id, created_at(sort: Desc)])
130
156
  @@index([consent_document_version_id])
131
157
  @@schema("public")
132
158
  }
@@ -38,7 +38,8 @@ model Document {
38
38
  offer_letter_template_snapshots OfferLetter[] @relation("OfferLetterTemplateSnapshot")
39
39
  offer_draft_edited_html Offer[] @relation("OfferDraftEditedHtml")
40
40
  application_fit_check_report Application? @relation("ApplicationFitCheckReportDocument")
41
- consent_document_versions ConsentDocumentVersion[]
41
+ terms_consent_versions ConsentDocumentVersion[] @relation("TermsDocument")
42
+ privacy_policy_consent_versions ConsentDocumentVersion[] @relation("PrivacyPolicyDocument")
42
43
 
43
44
  // Indexes
44
45
  @@index([candidate_id])