@adaptware/eagles-db 0.6.2 → 0.6.3

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.
Files changed (72) hide show
  1. package/client/edge.js +58 -87
  2. package/client/index-browser.js +53 -82
  3. package/client/index.d.ts +8769 -5614
  4. package/client/index.js +58 -87
  5. package/client/package.json +1 -1
  6. package/client/schema.prisma +225 -256
  7. package/client/wasm.js +58 -87
  8. package/package.json +1 -1
  9. package/prisma/.DS_Store +0 -0
  10. package/prisma/schema/.DS_Store +0 -0
  11. package/prisma/schema/consent.prisma +109 -34
  12. package/prisma/schema/document.prisma +1 -0
  13. package/prisma/schema/integration.prisma +0 -1
  14. package/prisma/schema/jobDescription.prisma +38 -37
  15. package/prisma/schema/migrations/.DS_Store +0 -0
  16. package/prisma/schema/migrations/20260826160000_add_application_fit_check_report_document/.DS_Store +0 -0
  17. package/prisma/schema/migrations/20261006120000_add_jd_restrict_candidate_upload/migration.sql +2 -0
  18. package/prisma/schema/organisation.prisma +6 -2
  19. package/prisma/schema/user.prisma +2 -0
  20. package/client/libquery_engine-darwin.dylib.node +0 -0
  21. package/client/libquery_engine-debian-openssl-3.0.x.so.node +0 -0
  22. package/client/query_engine-windows.dll.node +0 -0
  23. package/prisma/schema/migrations/20260522120000_ongoing_evaluation_record_kind/migration.sql +0 -25
  24. package/prisma/schema/migrations/20260523120000_replace_record_kind_with_is_committed/migration.sql +0 -24
  25. package/prisma/schema/migrations/20260528120000_drop_job_description_recommendation_config/migration.sql +0 -2
  26. package/prisma/schema/migrations/20260710120000_add_resume_rendered_export_fields/migration.sql +0 -9
  27. package/prisma/schema/migrations/20260714120000_add_job_description_display_html_document/migration.sql +0 -8
  28. package/prisma/schema/migrations/20260716120000_add_offer_letters/migration.sql +0 -183
  29. package/prisma/schema/migrations/20260716140000_offer_schema_refinements/migration.sql +0 -13
  30. package/prisma/schema/migrations/20260716160000_offer_schema_hardening/migration.sql +0 -95
  31. package/prisma/schema/migrations/20260716180000_offer_letter_template_config/migration.sql +0 -2
  32. package/prisma/schema/migrations/20260716190000_add_evaluation_focus_areas/migration.sql +0 -6
  33. package/prisma/schema/migrations/20260717120000_offer_workflow_approval/migration.sql +0 -30
  34. package/prisma/schema/migrations/20260720120000_offer_letter_template_is_draft/migration.sql +0 -5
  35. package/prisma/schema/migrations/20260720140000_offer_status_split/migration.sql +0 -51
  36. package/prisma/schema/migrations/20260720140001_offer_status_split_backfill/migration.sql +0 -37
  37. package/prisma/schema/migrations/20260722120000_offer_draft_edited_html/migration.sql +0 -13
  38. package/prisma/schema/migrations/20260723150000_offer_withdraw_actor_no_show_reason/migration.sql +0 -10
  39. package/prisma/schema/migrations/20260724120000_open_job_offer_accepted_declined_counts/migration.sql +0 -7
  40. package/prisma/schema/migrations/20260811120000_add_integration_provider_razorpay/migration.sql +0 -6
  41. package/prisma/schema/migrations/20260812120000_add_billing_transactions/migration.sql +0 -49
  42. package/prisma/schema/migrations/20260812130000_drop_billing_transaction_gst_snapshots/migration.sql +0 -3
  43. package/prisma/schema/migrations/20260812180000_billing_transaction_invoice_number/migration.sql +0 -5
  44. package/prisma/schema/migrations/20260813120000_payment_webhooks_gst_refunds/migration.sql +0 -79
  45. package/prisma/schema/migrations/20260813140000_platform_gst_profiles/migration.sql +0 -49
  46. package/prisma/schema/migrations/20260813150000_rename_gst_profiles/migration.sql +0 -53
  47. package/prisma/schema/migrations/20260813160000_remove_gst_billing/migration.sql +0 -16
  48. package/prisma/schema/migrations/20260813170000_billing_licensing_unrecoverable/migration.sql +0 -2
  49. package/prisma/schema/migrations/20260813180000_billing_transaction_payment_method/migration.sql +0 -2
  50. package/prisma/schema/migrations/20260814090000_billing_transaction_purchaser_email/migration.sql +0 -2
  51. package/prisma/schema/migrations/20260816100000_billing_product_organisations/migration.sql +0 -35
  52. package/prisma/schema/migrations/20260816120000_merge_billing_product_organisations/migration.sql +0 -25
  53. package/prisma/schema/migrations/20260817120000_billing_payment_mismatch/migration.sql +0 -7
  54. package/prisma/schema/migrations/20260819120000_billing_product_prices/migration.sql +0 -62
  55. package/prisma/schema/migrations/20260819140000_billing_exchange_rates/migration.sql +0 -25
  56. package/prisma/schema/migrations/20260820120000_billing_transaction_failure_category/migration.sql +0 -31
  57. package/prisma/schema/migrations/20260820130000_backfill_billing_transaction_failure_details/migration.sql +0 -23
  58. package/prisma/schema/migrations/20260820140000_drop_billing_product_price_overrides/migration.sql +0 -2
  59. package/prisma/schema/migrations/20260821120000_drop_billing_product_and_mock_licensing/migration.sql +0 -38
  60. package/prisma/schema/migrations/20260824120000_billing_transaction_purchase_display_name/migration.sql +0 -2
  61. package/prisma/schema/migrations/20260831120000_user_communication_email/migration.sql +0 -6
  62. package/prisma/schema/migrations/20260901143000_assessment_question_bank_state/migration.sql +0 -15
  63. package/prisma/schema/migrations/20260902120000_question_category_two_values/migration.sql +0 -16
  64. package/prisma/schema/migrations/20260902143000_question_bank_item_key/migration.sql +0 -17
  65. package/prisma/schema/migrations/20260903120000_split_round_type_assessment/migration.sql +0 -9
  66. package/prisma/schema/migrations/20260904110000_restore_round_type_assessment_enum/migration.sql +0 -5
  67. package/prisma/schema/migrations/20260904120000_revert_wrong_split_assessment_round_types/migration.sql +0 -42
  68. package/prisma/schema/migrations/20260909140000_profile_interview_session/migration.sql +0 -99
  69. package/prisma/schema/migrations/20260911120000_unify_profile_interview_into_interview/migration.sql +0 -139
  70. package/prisma/schema/migrations/20260929120000_add_evaluation_type_in_person/migration.sql +0 -2
  71. package/prisma/schema/payment/billingTransaction.prisma +0 -83
  72. package/prisma/schema/payment/paymentWebhookEvent.prisma +0 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptware/eagles-db",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
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
@@ -3,6 +3,8 @@
3
3
  enum ConsentType {
4
4
  PLATFORM_TERMS
5
5
  INTERVIEW_SESSION
6
+ /// Read-only catalog document; no ConsentRecord submit flow
7
+ PRIVACY_POLICY
6
8
 
7
9
  @@schema("public")
8
10
  }
@@ -47,34 +49,88 @@ enum DataErasureRequestStatus {
47
49
  @@schema("public")
48
50
  }
49
51
 
50
- model ConsentDocument {
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[]
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
59
 
60
60
  @@schema("public")
61
61
  }
62
62
 
63
+ 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])
79
+ @@schema("public")
80
+ }
81
+
63
82
  model ConsentDocumentVersion {
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[]
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
+ /// Legacy inline body; new versions use S3 template fields
90
+ content String? @db.Text
91
+ template_version_label String?
92
+ s3_bucket String?
93
+ /// Legacy single key; prefer s3_archive_key + s3_active_key
94
+ s3_key String?
95
+ s3_region String?
96
+ /// Immutable snapshot path (audit binding)
97
+ s3_archive_key String?
98
+ /// Read-optimized current copy under active/
99
+ s3_active_key String?
100
+ /// Decision 6 — immutable archive row in shared Document catalog
101
+ s3_document_id String?
102
+ s3_document Document? @relation(fields: [s3_document_id], references: [id], onDelete: SetNull)
103
+ status ConsentCatalogVersionStatus @default(PUBLISHED)
104
+ published_at DateTime?
105
+ published_by_id String?
106
+ published_by User? @relation("ConsentVersionPublishedBy", fields: [published_by_id], references: [id], onDelete: SetNull)
107
+ approval_notes String? @db.Text
108
+ supersedes_version_id String?
109
+ supersedes_version ConsentDocumentVersion? @relation("ConsentVersionSupersedes", fields: [supersedes_version_id], references: [id], onDelete: SetNull)
110
+ superseded_by ConsentDocumentVersion[] @relation("ConsentVersionSupersedes")
111
+ created_at DateTime @default(now())
112
+ checkboxes ConsentCheckboxDefinition[]
113
+ consent_records ConsentRecord[]
114
+ system_consent_epochs SystemConsentEpoch[]
115
+ version_approvals ConsentDocumentVersionApproval[]
75
116
 
76
117
  @@unique([document_id, version_number])
77
118
  @@index([document_id, published_at(sort: Desc)])
119
+ @@index([s3_document_id])
120
+ @@schema("public")
121
+ }
122
+
123
+ model ConsentDocumentVersionApproval {
124
+ id String @id @default(uuid())
125
+ document_version_id String
126
+ document_version ConsentDocumentVersion @relation(fields: [document_version_id], references: [id], onDelete: Cascade)
127
+ action String
128
+ actor_user_id String?
129
+ actor_user User? @relation("ConsentVersionApprovalActor", fields: [actor_user_id], references: [id], onDelete: SetNull)
130
+ notes String? @db.Text
131
+ created_at DateTime @default(now())
132
+
133
+ @@index([document_version_id, created_at(sort: Desc)])
78
134
  @@schema("public")
79
135
  }
80
136
 
@@ -93,26 +149,45 @@ model ConsentCheckboxDefinition {
93
149
  }
94
150
 
95
151
  model ConsentRecord {
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())
152
+ id String @id @default(uuid())
153
+ user_id String
154
+ user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
155
+ consent_type ConsentType
156
+ outcome ConsentOutcome
157
+ document_version_id String
158
+ document_version ConsentDocumentVersion @relation(fields: [document_version_id], references: [id], onDelete: Restrict)
159
+ template_version_label String?
160
+ context_snapshot Json?
161
+ selections Json @default("{}")
162
+ reference_type ConsentReferenceType?
163
+ reference_id String?
164
+ ip_address String?
165
+ user_agent String?
166
+ decline_reason String?
167
+ /// Copy of version s3_archive_key (or legacy s3_key) at grant time
168
+ storage_snapshot_key String?
169
+ content_hash_at_grant String?
170
+ created_at DateTime @default(now())
110
171
 
111
172
  @@index([user_id, consent_type, created_at(sort: Desc)])
112
173
  @@index([reference_type, reference_id, consent_type, created_at(sort: Desc)])
113
174
  @@schema("public")
114
175
  }
115
176
 
177
+ /// Platform-wide re-consent watermark (complements per-interview consent_epoch_at).
178
+ model SystemConsentEpoch {
179
+ id String @id @default(uuid())
180
+ consent_type ConsentType
181
+ epoch_at DateTime @default(now())
182
+ document_version_id String?
183
+ document_version ConsentDocumentVersion? @relation(fields: [document_version_id], references: [id], onDelete: SetNull)
184
+ reason String?
185
+ created_at DateTime @default(now())
186
+
187
+ @@index([consent_type, epoch_at(sort: Desc)])
188
+ @@schema("public")
189
+ }
190
+
116
191
  /// Append-only erasure plan snapshots (v1: DRY_RUN only in application code).
117
192
  model DataErasureRequest {
118
193
  id String @id @default(uuid())
@@ -38,6 +38,7 @@ 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
42
 
42
43
  // Indexes
43
44
  @@index([candidate_id])
@@ -7,7 +7,6 @@ enum IntegrationProvider {
7
7
  MICROSOFT
8
8
  ZOOM
9
9
  CALENDLY
10
- RAZORPAY
11
10
 
12
11
  @@schema("public")
13
12
  }
@@ -33,46 +33,47 @@ model JobDescription {
33
33
  closing_date DateTime?
34
34
  opened_at DateTime?
35
35
 
36
- job_number Int?
37
- job_code String? @unique
36
+ job_number Int?
37
+ job_code String? @unique
38
38
  // Audit fields
39
- created_at DateTime @default(now())
40
- updated_at DateTime @updatedAt
41
- created_by String
42
- updated_by String
43
- is_active Boolean @default(true)
44
- openings Int @default(1)
45
- job_profile_id String?
46
- job_profile JobProfile? @relation(fields: [job_profile_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
47
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
48
- department Department? @relation(fields: [department_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
49
- source_document Document? @relation("SourceDocument", fields: [source_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
50
- applications Application[]
51
- interviews Interview[]
52
- assignments Assignment[]
53
- fit_check FitCheck[] // one-to-many link
54
- job_description_data JobDescriptionData[] // one-to-many link
55
- evaluationPlan EvaluationPlan[] // relation to evaluation methods
56
- ongoing_evaluations OngoingEvaluation[] // optional one-to-many
57
- assignment_library AssignmentLibrary[]
58
- approvals Approval[] // one-to-many relation
59
- resumes Resume[] // one-to-many link
60
- budget Budget?
61
- hiring_manager User? @relation("HiringManager", fields: [hiring_manager_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
62
- recruiters User[]
63
- transcripts Transcript[]
64
- integration_job_syncs IntegrationJobSync[]
65
- job_application_template JobApplicationTemplate?
66
- offer_letter_templates OfferLetterTemplate[]
67
- offers Offer[]
68
- conversations Conversation[]
69
- communication_messages CommunicationMessage[]
39
+ created_at DateTime @default(now())
40
+ updated_at DateTime @updatedAt
41
+ created_by String
42
+ updated_by String
43
+ is_active Boolean @default(true)
44
+ openings Int @default(1)
45
+ restrict_candidate_upload_to_assigned_recruiters Boolean?
46
+ job_profile_id String?
47
+ job_profile JobProfile? @relation(fields: [job_profile_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
48
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
49
+ department Department? @relation(fields: [department_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
50
+ source_document Document? @relation("SourceDocument", fields: [source_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
51
+ applications Application[]
52
+ interviews Interview[]
53
+ assignments Assignment[]
54
+ fit_check FitCheck[] // one-to-many link
55
+ job_description_data JobDescriptionData[] // one-to-many link
56
+ evaluationPlan EvaluationPlan[] // relation to evaluation methods
57
+ ongoing_evaluations OngoingEvaluation[] // optional one-to-many
58
+ assignment_library AssignmentLibrary[]
59
+ approvals Approval[] // one-to-many relation
60
+ resumes Resume[] // one-to-many link
61
+ budget Budget?
62
+ hiring_manager User? @relation("HiringManager", fields: [hiring_manager_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
63
+ recruiters User[]
64
+ transcripts Transcript[]
65
+ integration_job_syncs IntegrationJobSync[]
66
+ job_application_template JobApplicationTemplate?
67
+ offer_letter_templates OfferLetterTemplate[]
68
+ offers Offer[]
69
+ conversations Conversation[]
70
+ communication_messages CommunicationMessage[]
70
71
  /// Plan line this opening is committed against (requisition → plan).
71
- hiring_plan_line_id String?
72
- hiring_plan_line HiringPlanLine? @relation("PlanLineRequisitions", fields: [hiring_plan_line_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
72
+ hiring_plan_line_id String?
73
+ hiring_plan_line HiringPlanLine? @relation("PlanLineRequisitions", fields: [hiring_plan_line_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
73
74
  /// Plan lines that use this JD as the role template/reference.
74
- referenced_by_plan_lines HiringPlanLine[] @relation("PlanLineTemplateJd")
75
- linked_hiring_units PurchasedHiringUnit[]
75
+ referenced_by_plan_lines HiringPlanLine[] @relation("PlanLineTemplateJd")
76
+ linked_hiring_units PurchasedHiringUnit[]
76
77
 
77
78
  @@index([organisation_id])
78
79
  @@index([hiring_manager_id])
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "JobDescription"
2
+ ADD COLUMN IF NOT EXISTS "restrict_candidate_upload_to_assigned_recruiters" BOOLEAN;
@@ -85,8 +85,12 @@ model Organisation {
85
85
  licensing_ledger_entries LicensingLedgerEntry[]
86
86
  license_package_organisations LicensePackageOrganisation[]
87
87
  ai_cost_ledger_entries AiCostLedgerEntry[]
88
- billing_transactions BillingTransaction[]
89
- payment_webhook_events PaymentWebhookEvent[]
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?
90
94
 
91
95
  @@index([name])
92
96
  @@schema("public")
@@ -104,6 +104,8 @@ 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")
107
109
  erasure_requests_as_subject DataErasureRequest[] @relation("ErasureSubjectUser")
108
110
  erasure_requests_requested DataErasureRequest[] @relation("ErasureRequestedByUser")
109
111
 
@@ -1,25 +0,0 @@
1
- -- Safe to re-run: adds record_kind without breaking existing ongoing evaluations.
2
-
3
- DO $$ BEGIN
4
- CREATE TYPE "OngoingEvaluationRecordKind" AS ENUM (
5
- 'AI_RECOMMENDED',
6
- 'PLAN_SELECTED',
7
- 'COMMITTED'
8
- );
9
- EXCEPTION
10
- WHEN duplicate_object THEN NULL;
11
- END $$;
12
-
13
- ALTER TABLE "OngoingEvaluation"
14
- ADD COLUMN IF NOT EXISTS "record_kind" "OngoingEvaluationRecordKind";
15
-
16
- ALTER TABLE "OngoingEvaluation"
17
- ALTER COLUMN "evaluation_plan_id" DROP NOT NULL;
18
-
19
- -- All existing rows are real pipeline rounds — not pre-Proceed drafts.
20
- UPDATE "OngoingEvaluation"
21
- SET "record_kind" = 'COMMITTED'
22
- WHERE "record_kind" IS NULL;
23
-
24
- CREATE INDEX IF NOT EXISTS "OngoingEvaluation_application_id_record_kind_idx"
25
- ON "OngoingEvaluation"("application_id", "record_kind");
@@ -1,24 +0,0 @@
1
- -- Replace record_kind enum with is_committed (null = legacy, false = draft, true = committed).
2
-
3
- ALTER TABLE "OngoingEvaluation"
4
- ADD COLUMN IF NOT EXISTS "is_committed" BOOLEAN;
5
-
6
- UPDATE "OngoingEvaluation"
7
- SET "is_committed" = false
8
- WHERE "record_kind" IN ('AI_RECOMMENDED', 'PLAN_SELECTED');
9
-
10
- UPDATE "OngoingEvaluation"
11
- SET "is_committed" = true
12
- WHERE "record_kind" = 'COMMITTED';
13
-
14
- -- Legacy rows without record_kind stay null (treated as committed in app queries).
15
-
16
- DROP INDEX IF EXISTS "OngoingEvaluation_application_id_record_kind_idx";
17
-
18
- ALTER TABLE "OngoingEvaluation"
19
- DROP COLUMN IF EXISTS "record_kind";
20
-
21
- DROP TYPE IF EXISTS "OngoingEvaluationRecordKind";
22
-
23
- CREATE INDEX IF NOT EXISTS "OngoingEvaluation_application_id_is_committed_idx"
24
- ON "OngoingEvaluation"("application_id", "is_committed");
@@ -1,2 +0,0 @@
1
- -- Drop unused per-job AI recommendation threshold storage (defaults live in application code).
2
- ALTER TABLE "JobDescription" DROP COLUMN IF EXISTS "recommendation_config";
@@ -1,9 +0,0 @@
1
- -- AlterTable
2
- ALTER TABLE "Resume" ADD COLUMN "rendered_export_document_id" TEXT,
3
- ADD COLUMN "resume_template_id" TEXT;
4
-
5
- -- CreateIndex
6
- CREATE UNIQUE INDEX "Resume_rendered_export_document_id_key" ON "Resume"("rendered_export_document_id");
7
-
8
- -- AddForeignKey
9
- ALTER TABLE "Resume" ADD CONSTRAINT "Resume_rendered_export_document_id_fkey" FOREIGN KEY ("rendered_export_document_id") REFERENCES "Document"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -1,8 +0,0 @@
1
- -- AlterTable
2
- ALTER TABLE "JobDescription" ADD COLUMN "display_html_document_id" TEXT;
3
-
4
- -- CreateIndex
5
- CREATE UNIQUE INDEX "JobDescription_display_html_document_id_key" ON "JobDescription"("display_html_document_id");
6
-
7
- -- AddForeignKey
8
- ALTER TABLE "JobDescription" ADD CONSTRAINT "JobDescription_display_html_document_id_fkey" FOREIGN KEY ("display_html_document_id") REFERENCES "Document"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -1,183 +0,0 @@
1
- -- CreateEnum
2
- CREATE TYPE "OfferSubstatus" AS ENUM ('OFFER_CREATED', 'OFFER_SENT', 'VIEWED', 'CHANGE_REQUESTED', 'ACCEPTED', 'DECLINED', 'EXPIRED', 'WITHDRAWN', 'JOINED');
3
-
4
- -- CreateEnum
5
- CREATE TYPE "OfferLetterTemplateScope" AS ENUM ('ORGANIZATION', 'JOB');
6
-
7
- -- CreateEnum
8
- CREATE TYPE "OfferChangeCategory" AS ENUM ('BUDGET', 'BENEFITS', 'JOINING_DATE', 'ROLE_TITLE', 'LOCATION', 'OTHER');
9
-
10
- -- CreateEnum
11
- CREATE TYPE "OfferChangeRequestStatus" AS ENUM ('OPEN', 'ADDRESSED');
12
-
13
- -- AlterTable
14
- ALTER TABLE "Application" ADD COLUMN "offer_substatus" "OfferSubstatus";
15
-
16
- -- CreateTable
17
- CREATE TABLE "OfferLetterTemplate" (
18
- "id" TEXT NOT NULL,
19
- "organisation_id" TEXT NOT NULL,
20
- "job_description_id" TEXT,
21
- "name" TEXT NOT NULL,
22
- "description" TEXT,
23
- "document_id" TEXT NOT NULL,
24
- "html_document_id" TEXT,
25
- "scope" "OfferLetterTemplateScope" NOT NULL DEFAULT 'ORGANIZATION',
26
- "is_default" BOOLEAN NOT NULL DEFAULT false,
27
- "is_active" BOOLEAN NOT NULL DEFAULT true,
28
- "created_by" TEXT NOT NULL,
29
- "updated_by" TEXT NOT NULL,
30
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
31
- "updated_at" TIMESTAMP(3) NOT NULL,
32
-
33
- CONSTRAINT "OfferLetterTemplate_pkey" PRIMARY KEY ("id")
34
- );
35
-
36
- -- CreateTable
37
- CREATE TABLE "Offer" (
38
- "id" TEXT NOT NULL,
39
- "application_id" TEXT NOT NULL,
40
- "organisation_id" TEXT NOT NULL,
41
- "candidate_id" TEXT NOT NULL,
42
- "job_description_id" TEXT NOT NULL,
43
- "template_id" TEXT,
44
- "substatus" "OfferSubstatus" NOT NULL DEFAULT 'OFFER_CREATED',
45
- "letter_version_count" INTEGER NOT NULL DEFAULT 0,
46
- "change_request_count" INTEGER NOT NULL DEFAULT 0,
47
- "terms" JSONB NOT NULL DEFAULT '{}',
48
- "expires_at" TIMESTAMP(3),
49
- "is_active" BOOLEAN NOT NULL DEFAULT true,
50
- "created_by" TEXT NOT NULL,
51
- "updated_by" TEXT NOT NULL,
52
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
53
- "updated_at" TIMESTAMP(3) NOT NULL,
54
-
55
- CONSTRAINT "Offer_pkey" PRIMARY KEY ("id")
56
- );
57
-
58
- -- CreateTable
59
- CREATE TABLE "OfferLetter" (
60
- "id" TEXT NOT NULL,
61
- "offer_id" TEXT NOT NULL,
62
- "version" INTEGER NOT NULL,
63
- "document_id" TEXT NOT NULL,
64
- "template_id" TEXT,
65
- "template_document_id" TEXT,
66
- "sent_at" TIMESTAMP(3),
67
- "viewed_at" TIMESTAMP(3),
68
- "change_request_note" TEXT,
69
- "is_active" BOOLEAN NOT NULL DEFAULT true,
70
- "created_by" TEXT NOT NULL,
71
- "updated_by" TEXT NOT NULL,
72
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
73
- "updated_at" TIMESTAMP(3) NOT NULL,
74
-
75
- CONSTRAINT "OfferLetter_pkey" PRIMARY KEY ("id")
76
- );
77
-
78
- -- CreateTable
79
- CREATE TABLE "OfferChangeRequest" (
80
- "id" TEXT NOT NULL,
81
- "offer_id" TEXT NOT NULL,
82
- "offer_letter_id" TEXT NOT NULL,
83
- "categories" "OfferChangeCategory"[],
84
- "note" TEXT,
85
- "status" "OfferChangeRequestStatus" NOT NULL DEFAULT 'OPEN',
86
- "created_by" TEXT NOT NULL,
87
- "updated_by" TEXT NOT NULL,
88
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
89
- "updated_at" TIMESTAMP(3) NOT NULL,
90
-
91
- CONSTRAINT "OfferChangeRequest_pkey" PRIMARY KEY ("id")
92
- );
93
-
94
- -- CreateIndex
95
- CREATE INDEX "OfferLetterTemplate_organisation_id_scope_idx" ON "OfferLetterTemplate"("organisation_id", "scope");
96
-
97
- -- CreateIndex
98
- CREATE INDEX "OfferLetterTemplate_job_description_id_idx" ON "OfferLetterTemplate"("job_description_id");
99
-
100
- -- CreateIndex
101
- CREATE INDEX "OfferLetterTemplate_document_id_idx" ON "OfferLetterTemplate"("document_id");
102
-
103
- -- CreateIndex
104
- CREATE INDEX "OfferLetterTemplate_html_document_id_idx" ON "OfferLetterTemplate"("html_document_id");
105
-
106
- -- CreateIndex
107
- CREATE UNIQUE INDEX "Offer_application_id_key" ON "Offer"("application_id");
108
-
109
- -- CreateIndex
110
- CREATE INDEX "Offer_organisation_id_idx" ON "Offer"("organisation_id");
111
-
112
- -- CreateIndex
113
- CREATE INDEX "Offer_candidate_id_idx" ON "Offer"("candidate_id");
114
-
115
- -- CreateIndex
116
- CREATE INDEX "Offer_job_description_id_idx" ON "Offer"("job_description_id");
117
-
118
- -- CreateIndex
119
- CREATE INDEX "Offer_substatus_idx" ON "Offer"("substatus");
120
-
121
- -- CreateIndex
122
- CREATE UNIQUE INDEX "OfferLetter_document_id_key" ON "OfferLetter"("document_id");
123
-
124
- -- CreateIndex
125
- CREATE INDEX "OfferLetter_offer_id_idx" ON "OfferLetter"("offer_id");
126
-
127
- -- CreateIndex
128
- CREATE INDEX "OfferLetter_template_id_idx" ON "OfferLetter"("template_id");
129
-
130
- -- CreateIndex
131
- CREATE UNIQUE INDEX "OfferLetter_offer_id_version_key" ON "OfferLetter"("offer_id", "version");
132
-
133
- -- CreateIndex
134
- CREATE INDEX "OfferChangeRequest_offer_id_status_idx" ON "OfferChangeRequest"("offer_id", "status");
135
-
136
- -- CreateIndex
137
- CREATE INDEX "OfferChangeRequest_offer_letter_id_idx" ON "OfferChangeRequest"("offer_letter_id");
138
-
139
- -- AddForeignKey
140
- ALTER TABLE "OfferLetterTemplate" ADD CONSTRAINT "OfferLetterTemplate_organisation_id_fkey" FOREIGN KEY ("organisation_id") REFERENCES "Organisation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
141
-
142
- -- AddForeignKey
143
- ALTER TABLE "OfferLetterTemplate" ADD CONSTRAINT "OfferLetterTemplate_job_description_id_fkey" FOREIGN KEY ("job_description_id") REFERENCES "JobDescription"("id") ON DELETE CASCADE ON UPDATE CASCADE;
144
-
145
- -- AddForeignKey
146
- ALTER TABLE "OfferLetterTemplate" ADD CONSTRAINT "OfferLetterTemplate_document_id_fkey" FOREIGN KEY ("document_id") REFERENCES "Document"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
147
-
148
- -- AddForeignKey
149
- ALTER TABLE "OfferLetterTemplate" ADD CONSTRAINT "OfferLetterTemplate_html_document_id_fkey" FOREIGN KEY ("html_document_id") REFERENCES "Document"("id") ON DELETE SET NULL ON UPDATE CASCADE;
150
-
151
- -- AddForeignKey
152
- ALTER TABLE "Offer" ADD CONSTRAINT "Offer_application_id_fkey" FOREIGN KEY ("application_id") REFERENCES "Application"("id") ON DELETE CASCADE ON UPDATE CASCADE;
153
-
154
- -- AddForeignKey
155
- ALTER TABLE "Offer" ADD CONSTRAINT "Offer_organisation_id_fkey" FOREIGN KEY ("organisation_id") REFERENCES "Organisation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
156
-
157
- -- AddForeignKey
158
- ALTER TABLE "Offer" ADD CONSTRAINT "Offer_candidate_id_fkey" FOREIGN KEY ("candidate_id") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
159
-
160
- -- AddForeignKey
161
- ALTER TABLE "Offer" ADD CONSTRAINT "Offer_job_description_id_fkey" FOREIGN KEY ("job_description_id") REFERENCES "JobDescription"("id") ON DELETE CASCADE ON UPDATE CASCADE;
162
-
163
- -- AddForeignKey
164
- ALTER TABLE "Offer" ADD CONSTRAINT "Offer_template_id_fkey" FOREIGN KEY ("template_id") REFERENCES "OfferLetterTemplate"("id") ON DELETE SET NULL ON UPDATE CASCADE;
165
-
166
- -- AddForeignKey
167
- ALTER TABLE "OfferLetter" ADD CONSTRAINT "OfferLetter_offer_id_fkey" FOREIGN KEY ("offer_id") REFERENCES "Offer"("id") ON DELETE CASCADE ON UPDATE CASCADE;
168
-
169
- -- AddForeignKey
170
- ALTER TABLE "OfferLetter" ADD CONSTRAINT "OfferLetter_document_id_fkey" FOREIGN KEY ("document_id") REFERENCES "Document"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
171
-
172
- -- AddForeignKey
173
- ALTER TABLE "OfferLetter" ADD CONSTRAINT "OfferLetter_template_id_fkey" FOREIGN KEY ("template_id") REFERENCES "OfferLetterTemplate"("id") ON DELETE SET NULL ON UPDATE CASCADE;
174
-
175
- -- AddForeignKey
176
- ALTER TABLE "OfferLetter" ADD CONSTRAINT "OfferLetter_template_document_id_fkey" FOREIGN KEY ("template_document_id") REFERENCES "Document"("id") ON DELETE SET NULL ON UPDATE CASCADE;
177
-
178
- -- AddForeignKey
179
- ALTER TABLE "OfferChangeRequest" ADD CONSTRAINT "OfferChangeRequest_offer_id_fkey" FOREIGN KEY ("offer_id") REFERENCES "Offer"("id") ON DELETE CASCADE ON UPDATE CASCADE;
180
-
181
- -- AddForeignKey
182
- ALTER TABLE "OfferChangeRequest" ADD CONSTRAINT "OfferChangeRequest_offer_letter_id_fkey" FOREIGN KEY ("offer_letter_id") REFERENCES "OfferLetter"("id") ON DELETE CASCADE ON UPDATE CASCADE;
183
-
@@ -1,13 +0,0 @@
1
- -- CreateEnum
2
- CREATE TYPE "WorkMode" AS ENUM ('REMOTE', 'OFFICE', 'HYBRID');
3
-
4
- -- AlterEnum
5
- ALTER TYPE "OfferChangeRequestStatus" ADD VALUE 'IN_PROGRESS';
6
- ALTER TYPE "OfferChangeRequestStatus" ADD VALUE 'REJECTED';
7
- ALTER TYPE "OfferChangeRequestStatus" ADD VALUE 'WITHDRAWN';
8
- ALTER TYPE "OfferChangeRequestStatus" ADD VALUE 'EXPIRED';
9
-
10
- -- AlterTable
11
- ALTER TABLE "OfferChangeRequest" ADD COLUMN "details" JSONB,
12
- ADD COLUMN "hr_note" TEXT,
13
- ADD COLUMN "resolved_at" TIMESTAMP(3);