@adaptware/eagles-db 0.6.5 → 0.6.7

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.5",
3
+ "version": "0.6.7",
4
4
  "description": "A Prisma client package for Treadspace database operations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -3,8 +3,6 @@
3
3
  enum ConsentType {
4
4
  PLATFORM_TERMS
5
5
  INTERVIEW_SESSION
6
- /// Read-only catalog document; no ConsentRecord submit flow
7
- PRIVACY_POLICY
8
6
 
9
7
  @@schema("public")
10
8
  }
@@ -49,86 +47,34 @@ enum DataErasureRequestStatus {
49
47
  @@schema("public")
50
48
  }
51
49
 
52
- /// Lifecycle for org-managed legal versions (platform seed publishes as PUBLISHED immediately).
53
- enum ConsentCatalogVersionStatus {
54
- DRAFT
55
- PUBLISHED
56
- ARCHIVED
57
- /// Emergency takedown — grants blocked even during manifest grace window
58
- REVOKED
59
-
60
- @@schema("public")
61
- }
62
-
63
50
  model ConsentDocument {
64
- id String @id @default(uuid())
65
- /// Stable key within scope — platform: `platform_terms`, org interview: `interview_session`
66
- slug String
67
- consent_type ConsentType
68
- /// Null = platform-wide catalog row; set = tenant-specific overlay (v1: interview session notice)
69
- organisation_id String?
70
- organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: Cascade)
71
- display_name String?
72
- is_active Boolean @default(true)
73
- created_at DateTime @default(now())
74
- updated_at DateTime @updatedAt
75
- versions ConsentDocumentVersion[]
76
-
77
- @@unique([organisation_id, slug])
78
- @@index([consent_type, organisation_id, is_active])
51
+ id String @id @default(uuid())
52
+ /// Stable key, e.g. PLATFORM_TERMS, INTERVIEW_SESSION_DEFAULT
53
+ slug String @unique
54
+ consent_type ConsentType
55
+ is_active Boolean @default(true)
56
+ created_at DateTime @default(now())
57
+ updated_at DateTime @updatedAt
58
+ versions ConsentDocumentVersion[]
59
+
79
60
  @@schema("public")
80
61
  }
81
62
 
82
63
  model ConsentDocumentVersion {
83
- id String @id @default(uuid())
84
- document_id String
85
- document ConsentDocument @relation(fields: [document_id], references: [id], onDelete: Cascade)
86
- version_number Int
87
- content_hash String
88
- locale String @default("en")
89
- template_version_label String?
90
- s3_bucket String?
91
- /// Legacy single key; prefer s3_archive_key + s3_active_key
92
- s3_key String?
93
- s3_region String?
94
- /// Immutable snapshot path (audit binding)
95
- s3_archive_key String?
96
- /// Read-optimized current copy under active/
97
- s3_active_key String?
98
- /// Decision 6 — immutable archive row in shared Document catalog
99
- s3_document_id String?
100
- s3_document Document? @relation(fields: [s3_document_id], references: [id], onDelete: SetNull)
101
- status ConsentCatalogVersionStatus @default(PUBLISHED)
102
- published_at DateTime?
103
- published_by_id String?
104
- published_by User? @relation("ConsentVersionPublishedBy", fields: [published_by_id], references: [id], onDelete: SetNull)
105
- approval_notes String? @db.Text
106
- supersedes_version_id String?
107
- supersedes_version ConsentDocumentVersion? @relation("ConsentVersionSupersedes", fields: [supersedes_version_id], references: [id], onDelete: SetNull)
108
- superseded_by ConsentDocumentVersion[] @relation("ConsentVersionSupersedes")
109
- created_at DateTime @default(now())
110
- checkboxes ConsentCheckboxDefinition[]
111
- consent_records ConsentRecord[]
112
- system_consent_epochs SystemConsentEpoch[]
113
- version_approvals ConsentDocumentVersionApproval[]
64
+ id String @id @default(uuid())
65
+ document_id String
66
+ document ConsentDocument @relation(fields: [document_id], references: [id], onDelete: Cascade)
67
+ version_number Int
68
+ content_hash String
69
+ locale String @default("en")
70
+ content String @db.Text
71
+ published_at DateTime?
72
+ created_at DateTime @default(now())
73
+ checkboxes ConsentCheckboxDefinition[]
74
+ consent_records ConsentRecord[]
114
75
 
115
76
  @@unique([document_id, version_number])
116
77
  @@index([document_id, published_at(sort: Desc)])
117
- @@index([s3_document_id])
118
- @@schema("public")
119
- }
120
-
121
- model ConsentDocumentVersionApproval {
122
- id String @id @default(uuid())
123
- document_version_id String
124
- document_version ConsentDocumentVersion @relation(fields: [document_version_id], references: [id], onDelete: Cascade)
125
- action String
126
- actor_user_id String?
127
- actor_user User? @relation("ConsentVersionApprovalActor", fields: [actor_user_id], references: [id], onDelete: SetNull)
128
- notes String? @db.Text
129
- created_at DateTime @default(now())
130
-
131
- @@index([document_version_id, created_at(sort: Desc)])
132
78
  @@schema("public")
133
79
  }
134
80
 
@@ -147,46 +93,26 @@ model ConsentCheckboxDefinition {
147
93
  }
148
94
 
149
95
  model ConsentRecord {
150
- id String @id @default(uuid())
151
- user_id String
152
- user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
153
- consent_type ConsentType
154
- outcome ConsentOutcome
155
- document_version_id String
156
- document_version ConsentDocumentVersion @relation(fields: [document_version_id], references: [id], onDelete: Restrict)
157
- template_version_label String?
158
- context_snapshot Json?
159
- selections Json @default("{}")
160
- reference_type ConsentReferenceType?
161
- reference_id String?
162
- ip_address String?
163
- user_agent String?
164
- decline_reason String?
165
- /// Copy of version s3_archive_key (or legacy s3_key) at grant time
166
- storage_snapshot_key String?
167
- content_hash_at_grant String?
168
- created_at DateTime @default(now())
96
+ id String @id @default(uuid())
97
+ user_id String
98
+ user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
99
+ consent_type ConsentType
100
+ outcome ConsentOutcome
101
+ document_version_id String
102
+ document_version ConsentDocumentVersion @relation(fields: [document_version_id], references: [id], onDelete: Restrict)
103
+ selections Json @default("{}")
104
+ reference_type ConsentReferenceType?
105
+ reference_id String?
106
+ ip_address String?
107
+ user_agent String?
108
+ decline_reason String?
109
+ created_at DateTime @default(now())
169
110
 
170
111
  @@index([user_id, consent_type, created_at(sort: Desc)])
171
112
  @@index([reference_type, reference_id, consent_type, created_at(sort: Desc)])
172
113
  @@schema("public")
173
114
  }
174
115
 
175
- // Platform-wide re-consent watermark (complements per-interview consent_epoch_at).
176
- // epoch_at is the effective instant for platform re-consent (can differ from created_at when policy changes are backdated).
177
- model SystemConsentEpoch {
178
- id String @id @default(uuid())
179
- consent_type ConsentType
180
- epoch_at DateTime @default(now())
181
- document_version_id String?
182
- document_version ConsentDocumentVersion? @relation(fields: [document_version_id], references: [id], onDelete: SetNull)
183
- reason String?
184
- created_at DateTime @default(now())
185
-
186
- @@index([consent_type, epoch_at(sort: Desc)])
187
- @@schema("public")
188
- }
189
-
190
116
  /// Append-only erasure plan snapshots (v1: DRY_RUN only in application code).
191
117
  model DataErasureRequest {
192
118
  id String @id @default(uuid())
@@ -38,7 +38,6 @@ 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[]
42
41
 
43
42
  // Indexes
44
43
  @@index([candidate_id])
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "Resume"
2
+ ADD COLUMN IF NOT EXISTS "archived_at" TIMESTAMP(3);
@@ -85,12 +85,6 @@ model Organisation {
85
85
  licensing_ledger_entries LicensingLedgerEntry[]
86
86
  license_package_organisations LicensePackageOrganisation[]
87
87
  ai_cost_ledger_entries AiCostLedgerEntry[]
88
- consent_documents ConsentDocument[]
89
- /// Deprecated — migrate to org-scoped ConsentDocument; kept for legacy S3 fallback until backfill completes
90
- has_custom_consent Boolean @default(false)
91
- consent_s3_bucket String?
92
- consent_s3_region String?
93
- custom_interview_consent_s3_key_prefix String?
94
88
 
95
89
  @@index([name])
96
90
  @@schema("public")
@@ -63,6 +63,9 @@ model Resume {
63
63
  conversation_history Json?
64
64
  /// Progress 0-100 reported by the ResumeIntake workflow.
65
65
  intake_progress Int?
66
+ /// Set when the candidate archives the resume; null = active. Archived
67
+ /// resumes are hidden from resume pickers (e.g. the apply flow).
68
+ archived_at DateTime?
66
69
  /// Last Orion execution id for the intake/generate workflow, for tracing.
67
70
  orion_execution_id String?
68
71
  /// Snapshot of the candidate's own words, taken immediately before the
@@ -104,8 +104,6 @@ model User {
104
104
  department_members DepartmentMember[] @relation("DepartmentMemberships")
105
105
  assigned_hiring_units PurchasedHiringUnit[] @relation("AssignedHiringUnits")
106
106
  consent_records ConsentRecord[]
107
- consent_versions_published ConsentDocumentVersion[] @relation("ConsentVersionPublishedBy")
108
- consent_version_approval_actions ConsentDocumentVersionApproval[] @relation("ConsentVersionApprovalActor")
109
107
  erasure_requests_as_subject DataErasureRequest[] @relation("ErasureSubjectUser")
110
108
  erasure_requests_requested DataErasureRequest[] @relation("ErasureRequestedByUser")
111
109