@adaptware/eagles-db 0.6.6 → 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.6",
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,62 +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
- /// Immutable snapshot path (audit binding)
92
- s3_archive_key String?
93
- /// Read-optimized current copy under active/
94
- s3_active_key String?
95
- /// Optional immutable archive row in shared Document catalog (org ingest)
96
- s3_document_id String?
97
- s3_document Document? @relation(fields: [s3_document_id], references: [id], onDelete: SetNull)
98
- status ConsentCatalogVersionStatus @default(PUBLISHED)
99
- published_at DateTime?
100
- created_at DateTime @default(now())
101
- checkboxes ConsentCheckboxDefinition[]
102
- consent_records ConsentRecord[]
103
- system_consent_epochs SystemConsentEpoch[]
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[]
104
75
 
105
76
  @@unique([document_id, version_number])
106
77
  @@index([document_id, published_at(sort: Desc)])
107
- @@index([s3_document_id])
108
78
  @@schema("public")
109
79
  }
110
80
 
@@ -123,43 +93,26 @@ model ConsentCheckboxDefinition {
123
93
  }
124
94
 
125
95
  model ConsentRecord {
126
- id String @id @default(uuid())
127
- user_id String
128
- user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
129
- consent_type ConsentType
130
- outcome ConsentOutcome
131
- document_version_id String
132
- document_version ConsentDocumentVersion @relation(fields: [document_version_id], references: [id], onDelete: Restrict)
133
- template_version_label String?
134
- context_snapshot Json?
135
- selections Json @default("{}")
136
- reference_type ConsentReferenceType?
137
- reference_id String?
138
- ip_address String?
139
- user_agent String?
140
- decline_reason String?
141
- 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())
142
110
 
143
111
  @@index([user_id, consent_type, created_at(sort: Desc)])
144
112
  @@index([reference_type, reference_id, consent_type, created_at(sort: Desc)])
145
113
  @@schema("public")
146
114
  }
147
115
 
148
- // Platform-wide re-consent watermark (complements per-interview consent_epoch_at).
149
- // epoch_at is the effective instant for platform re-consent (can differ from created_at when policy changes are backdated).
150
- model SystemConsentEpoch {
151
- id String @id @default(uuid())
152
- consent_type ConsentType
153
- epoch_at DateTime @default(now())
154
- document_version_id String?
155
- document_version ConsentDocumentVersion? @relation(fields: [document_version_id], references: [id], onDelete: SetNull)
156
- reason String?
157
- created_at DateTime @default(now())
158
-
159
- @@index([consent_type, epoch_at(sort: Desc)])
160
- @@schema("public")
161
- }
162
-
163
116
  /// Append-only erasure plan snapshots (v1: DRY_RUN only in application code).
164
117
  model DataErasureRequest {
165
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