@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
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "prisma-client-eebffb0499b35f12bacd8d35ebf5cc1c9baa338e0b0022df3ae85f389451d7e6",
2
+ "name": "prisma-client-db1234d0157131c2946806471e92bfc81687b8c6cdebc98ad1f3994ad413a64b",
3
3
  "main": "index.js",
4
4
  "types": "index.d.ts",
5
5
  "browser": "default.js",
@@ -1253,6 +1253,8 @@ model CompetencyDictionary {
1253
1253
  enum ConsentType {
1254
1254
  PLATFORM_TERMS
1255
1255
  INTERVIEW_SESSION
1256
+ /// Read-only catalog document; no ConsentRecord submit flow
1257
+ PRIVACY_POLICY
1256
1258
 
1257
1259
  @@schema("public")
1258
1260
  }
@@ -1297,34 +1299,88 @@ enum DataErasureRequestStatus {
1297
1299
  @@schema("public")
1298
1300
  }
1299
1301
 
1302
+ /// Lifecycle for org-managed legal versions (platform seed publishes as PUBLISHED immediately).
1303
+ enum ConsentCatalogVersionStatus {
1304
+ DRAFT
1305
+ PUBLISHED
1306
+ ARCHIVED
1307
+ /// Emergency takedown — grants blocked even during manifest grace window
1308
+ REVOKED
1309
+
1310
+ @@schema("public")
1311
+ }
1312
+
1300
1313
  model ConsentDocument {
1301
- id String @id @default(uuid())
1302
- /// Stable key, e.g. PLATFORM_TERMS, INTERVIEW_SESSION_DEFAULT
1303
- slug String @unique
1304
- consent_type ConsentType
1305
- is_active Boolean @default(true)
1306
- created_at DateTime @default(now())
1307
- updated_at DateTime @updatedAt
1308
- versions ConsentDocumentVersion[]
1314
+ id String @id @default(uuid())
1315
+ /// Stable key within scope — platform: `platform_terms`, org interview: `interview_session`
1316
+ slug String
1317
+ consent_type ConsentType
1318
+ /// Null = platform-wide catalog row; set = tenant-specific overlay (v1: interview session notice)
1319
+ organisation_id String?
1320
+ organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: Cascade)
1321
+ display_name String?
1322
+ is_active Boolean @default(true)
1323
+ created_at DateTime @default(now())
1324
+ updated_at DateTime @updatedAt
1325
+ versions ConsentDocumentVersion[]
1309
1326
 
1327
+ @@unique([organisation_id, slug])
1328
+ @@index([consent_type, organisation_id, is_active])
1310
1329
  @@schema("public")
1311
1330
  }
1312
1331
 
1313
1332
  model ConsentDocumentVersion {
1314
- id String @id @default(uuid())
1315
- document_id String
1316
- document ConsentDocument @relation(fields: [document_id], references: [id], onDelete: Cascade)
1317
- version_number Int
1318
- content_hash String
1319
- locale String @default("en")
1320
- content String @db.Text
1321
- published_at DateTime?
1322
- created_at DateTime @default(now())
1323
- checkboxes ConsentCheckboxDefinition[]
1324
- consent_records ConsentRecord[]
1333
+ id String @id @default(uuid())
1334
+ document_id String
1335
+ document ConsentDocument @relation(fields: [document_id], references: [id], onDelete: Cascade)
1336
+ version_number Int
1337
+ content_hash String
1338
+ locale String @default("en")
1339
+ /// Legacy inline body; new versions use S3 template fields
1340
+ content String? @db.Text
1341
+ template_version_label String?
1342
+ s3_bucket String?
1343
+ /// Legacy single key; prefer s3_archive_key + s3_active_key
1344
+ s3_key String?
1345
+ s3_region String?
1346
+ /// Immutable snapshot path (audit binding)
1347
+ s3_archive_key String?
1348
+ /// Read-optimized current copy under active/
1349
+ s3_active_key String?
1350
+ /// Decision 6 — immutable archive row in shared Document catalog
1351
+ s3_document_id String?
1352
+ s3_document Document? @relation(fields: [s3_document_id], references: [id], onDelete: SetNull)
1353
+ status ConsentCatalogVersionStatus @default(PUBLISHED)
1354
+ published_at DateTime?
1355
+ published_by_id String?
1356
+ published_by User? @relation("ConsentVersionPublishedBy", fields: [published_by_id], references: [id], onDelete: SetNull)
1357
+ approval_notes String? @db.Text
1358
+ supersedes_version_id String?
1359
+ supersedes_version ConsentDocumentVersion? @relation("ConsentVersionSupersedes", fields: [supersedes_version_id], references: [id], onDelete: SetNull)
1360
+ superseded_by ConsentDocumentVersion[] @relation("ConsentVersionSupersedes")
1361
+ created_at DateTime @default(now())
1362
+ checkboxes ConsentCheckboxDefinition[]
1363
+ consent_records ConsentRecord[]
1364
+ system_consent_epochs SystemConsentEpoch[]
1365
+ version_approvals ConsentDocumentVersionApproval[]
1325
1366
 
1326
1367
  @@unique([document_id, version_number])
1327
1368
  @@index([document_id, published_at(sort: Desc)])
1369
+ @@index([s3_document_id])
1370
+ @@schema("public")
1371
+ }
1372
+
1373
+ model ConsentDocumentVersionApproval {
1374
+ id String @id @default(uuid())
1375
+ document_version_id String
1376
+ document_version ConsentDocumentVersion @relation(fields: [document_version_id], references: [id], onDelete: Cascade)
1377
+ action String
1378
+ actor_user_id String?
1379
+ actor_user User? @relation("ConsentVersionApprovalActor", fields: [actor_user_id], references: [id], onDelete: SetNull)
1380
+ notes String? @db.Text
1381
+ created_at DateTime @default(now())
1382
+
1383
+ @@index([document_version_id, created_at(sort: Desc)])
1328
1384
  @@schema("public")
1329
1385
  }
1330
1386
 
@@ -1343,26 +1399,45 @@ model ConsentCheckboxDefinition {
1343
1399
  }
1344
1400
 
1345
1401
  model ConsentRecord {
1346
- id String @id @default(uuid())
1347
- user_id String
1348
- user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
1349
- consent_type ConsentType
1350
- outcome ConsentOutcome
1351
- document_version_id String
1352
- document_version ConsentDocumentVersion @relation(fields: [document_version_id], references: [id], onDelete: Restrict)
1353
- selections Json @default("{}")
1354
- reference_type ConsentReferenceType?
1355
- reference_id String?
1356
- ip_address String?
1357
- user_agent String?
1358
- decline_reason String?
1359
- created_at DateTime @default(now())
1402
+ id String @id @default(uuid())
1403
+ user_id String
1404
+ user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
1405
+ consent_type ConsentType
1406
+ outcome ConsentOutcome
1407
+ document_version_id String
1408
+ document_version ConsentDocumentVersion @relation(fields: [document_version_id], references: [id], onDelete: Restrict)
1409
+ template_version_label String?
1410
+ context_snapshot Json?
1411
+ selections Json @default("{}")
1412
+ reference_type ConsentReferenceType?
1413
+ reference_id String?
1414
+ ip_address String?
1415
+ user_agent String?
1416
+ decline_reason String?
1417
+ /// Copy of version s3_archive_key (or legacy s3_key) at grant time
1418
+ storage_snapshot_key String?
1419
+ content_hash_at_grant String?
1420
+ created_at DateTime @default(now())
1360
1421
 
1361
1422
  @@index([user_id, consent_type, created_at(sort: Desc)])
1362
1423
  @@index([reference_type, reference_id, consent_type, created_at(sort: Desc)])
1363
1424
  @@schema("public")
1364
1425
  }
1365
1426
 
1427
+ /// Platform-wide re-consent watermark (complements per-interview consent_epoch_at).
1428
+ model SystemConsentEpoch {
1429
+ id String @id @default(uuid())
1430
+ consent_type ConsentType
1431
+ epoch_at DateTime @default(now())
1432
+ document_version_id String?
1433
+ document_version ConsentDocumentVersion? @relation(fields: [document_version_id], references: [id], onDelete: SetNull)
1434
+ reason String?
1435
+ created_at DateTime @default(now())
1436
+
1437
+ @@index([consent_type, epoch_at(sort: Desc)])
1438
+ @@schema("public")
1439
+ }
1440
+
1366
1441
  /// Append-only erasure plan snapshots (v1: DRY_RUN only in application code).
1367
1442
  model DataErasureRequest {
1368
1443
  id String @id @default(uuid())
@@ -1545,6 +1620,7 @@ model Document {
1545
1620
  offer_letter_template_snapshots OfferLetter[] @relation("OfferLetterTemplateSnapshot")
1546
1621
  offer_draft_edited_html Offer[] @relation("OfferDraftEditedHtml")
1547
1622
  application_fit_check_report Application? @relation("ApplicationFitCheckReportDocument")
1623
+ consent_document_versions ConsentDocumentVersion[]
1548
1624
 
1549
1625
  // Indexes
1550
1626
  @@index([candidate_id])
@@ -1982,7 +2058,6 @@ enum IntegrationProvider {
1982
2058
  MICROSOFT
1983
2059
  ZOOM
1984
2060
  CALENDLY
1985
- RAZORPAY
1986
2061
 
1987
2062
  @@schema("public")
1988
2063
  }
@@ -2664,46 +2739,47 @@ model JobDescription {
2664
2739
  closing_date DateTime?
2665
2740
  opened_at DateTime?
2666
2741
 
2667
- job_number Int?
2668
- job_code String? @unique
2742
+ job_number Int?
2743
+ job_code String? @unique
2669
2744
  // Audit fields
2670
- created_at DateTime @default(now())
2671
- updated_at DateTime @updatedAt
2672
- created_by String
2673
- updated_by String
2674
- is_active Boolean @default(true)
2675
- openings Int @default(1)
2676
- job_profile_id String?
2677
- job_profile JobProfile? @relation(fields: [job_profile_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2678
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2679
- department Department? @relation(fields: [department_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2680
- source_document Document? @relation("SourceDocument", fields: [source_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2681
- applications Application[]
2682
- interviews Interview[]
2683
- assignments Assignment[]
2684
- fit_check FitCheck[] // one-to-many link
2685
- job_description_data JobDescriptionData[] // one-to-many link
2686
- evaluationPlan EvaluationPlan[] // relation to evaluation methods
2687
- ongoing_evaluations OngoingEvaluation[] // optional one-to-many
2688
- assignment_library AssignmentLibrary[]
2689
- approvals Approval[] // one-to-many relation
2690
- resumes Resume[] // one-to-many link
2691
- budget Budget?
2692
- hiring_manager User? @relation("HiringManager", fields: [hiring_manager_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2693
- recruiters User[]
2694
- transcripts Transcript[]
2695
- integration_job_syncs IntegrationJobSync[]
2696
- job_application_template JobApplicationTemplate?
2697
- offer_letter_templates OfferLetterTemplate[]
2698
- offers Offer[]
2699
- conversations Conversation[]
2700
- communication_messages CommunicationMessage[]
2745
+ created_at DateTime @default(now())
2746
+ updated_at DateTime @updatedAt
2747
+ created_by String
2748
+ updated_by String
2749
+ is_active Boolean @default(true)
2750
+ openings Int @default(1)
2751
+ restrict_candidate_upload_to_assigned_recruiters Boolean?
2752
+ job_profile_id String?
2753
+ job_profile JobProfile? @relation(fields: [job_profile_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2754
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2755
+ department Department? @relation(fields: [department_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2756
+ source_document Document? @relation("SourceDocument", fields: [source_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2757
+ applications Application[]
2758
+ interviews Interview[]
2759
+ assignments Assignment[]
2760
+ fit_check FitCheck[] // one-to-many link
2761
+ job_description_data JobDescriptionData[] // one-to-many link
2762
+ evaluationPlan EvaluationPlan[] // relation to evaluation methods
2763
+ ongoing_evaluations OngoingEvaluation[] // optional one-to-many
2764
+ assignment_library AssignmentLibrary[]
2765
+ approvals Approval[] // one-to-many relation
2766
+ resumes Resume[] // one-to-many link
2767
+ budget Budget?
2768
+ hiring_manager User? @relation("HiringManager", fields: [hiring_manager_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2769
+ recruiters User[]
2770
+ transcripts Transcript[]
2771
+ integration_job_syncs IntegrationJobSync[]
2772
+ job_application_template JobApplicationTemplate?
2773
+ offer_letter_templates OfferLetterTemplate[]
2774
+ offers Offer[]
2775
+ conversations Conversation[]
2776
+ communication_messages CommunicationMessage[]
2701
2777
  /// Plan line this opening is committed against (requisition → plan).
2702
- hiring_plan_line_id String?
2703
- hiring_plan_line HiringPlanLine? @relation("PlanLineRequisitions", fields: [hiring_plan_line_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2778
+ hiring_plan_line_id String?
2779
+ hiring_plan_line HiringPlanLine? @relation("PlanLineRequisitions", fields: [hiring_plan_line_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2704
2780
  /// Plan lines that use this JD as the role template/reference.
2705
- referenced_by_plan_lines HiringPlanLine[] @relation("PlanLineTemplateJd")
2706
- linked_hiring_units PurchasedHiringUnit[]
2781
+ referenced_by_plan_lines HiringPlanLine[] @relation("PlanLineTemplateJd")
2782
+ linked_hiring_units PurchasedHiringUnit[]
2707
2783
 
2708
2784
  @@index([organisation_id])
2709
2785
  @@index([hiring_manager_id])
@@ -3685,75 +3761,79 @@ enum HiringUnitAssignmentScope {
3685
3761
  }
3686
3762
 
3687
3763
  model Organisation {
3688
- id String @id @default(uuid())
3689
- name String @unique
3690
- industry String
3691
- about String
3692
- website String
3693
- size OrganisationSize @default(ONE_TO_TEN)
3694
- phone String
3695
- address String
3696
- company_values Json[]
3697
- allowed_email_domains String[]
3698
- send_email Boolean @default(true)
3699
- interviewers User[]
3700
- created_at DateTime @default(now())
3701
- updated_at DateTime @updatedAt
3702
- created_by String
3703
- updated_by String
3704
- is_active Boolean @default(true)
3705
- alias String? @unique
3706
- logo String?
3707
- job_sequence Int @default(1)
3708
- employee_sequence Int @default(1)
3709
- applications Application[]
3710
- user_roles UserRole[]
3711
- job_descriptions JobDescription[]
3712
- job_profiles JobProfile[]
3713
- assessment_library AssessmentLibrary[]
3714
- assignment_library AssignmentLibrary[]
3715
- interviews Interview[]
3716
- assignments Assignment[]
3717
- fit_check FitCheck[] // one-to-many link
3718
- resumes Resume[] // one-to-many link
3719
- approvals Approval[] // one-to-many link
3720
- suggestions Suggestion[]
3721
- ongoing_evaluations OngoingEvaluation[] // optional one-to-many
3722
- actions Action[]
3723
- integration_credentials IntegrationCredential[]
3724
- zoho_sync_mappings ZohoSyncMapping[]
3725
- assessments Assessment[]
3726
- timezone String @default("Asia/Kolkata")
3764
+ id String @id @default(uuid())
3765
+ name String @unique
3766
+ industry String
3767
+ about String
3768
+ website String
3769
+ size OrganisationSize @default(ONE_TO_TEN)
3770
+ phone String
3771
+ address String
3772
+ company_values Json[]
3773
+ allowed_email_domains String[]
3774
+ send_email Boolean @default(true)
3775
+ interviewers User[]
3776
+ created_at DateTime @default(now())
3777
+ updated_at DateTime @updatedAt
3778
+ created_by String
3779
+ updated_by String
3780
+ is_active Boolean @default(true)
3781
+ alias String? @unique
3782
+ logo String?
3783
+ job_sequence Int @default(1)
3784
+ employee_sequence Int @default(1)
3785
+ applications Application[]
3786
+ user_roles UserRole[]
3787
+ job_descriptions JobDescription[]
3788
+ job_profiles JobProfile[]
3789
+ assessment_library AssessmentLibrary[]
3790
+ assignment_library AssignmentLibrary[]
3791
+ interviews Interview[]
3792
+ assignments Assignment[]
3793
+ fit_check FitCheck[] // one-to-many link
3794
+ resumes Resume[] // one-to-many link
3795
+ approvals Approval[] // one-to-many link
3796
+ suggestions Suggestion[]
3797
+ ongoing_evaluations OngoingEvaluation[] // optional one-to-many
3798
+ actions Action[]
3799
+ integration_credentials IntegrationCredential[]
3800
+ zoho_sync_mappings ZohoSyncMapping[]
3801
+ assessments Assessment[]
3802
+ timezone String @default("Asia/Kolkata")
3727
3803
  /// ISO 3166-1 alpha-2 (e.g. IN).
3728
- country_code String @default("IN")
3804
+ country_code String @default("IN")
3729
3805
  /// Who may consume unused hiring units. Does not rewrite unit rows when changed.
3730
- hiring_unit_assignment_scope HiringUnitAssignmentScope @default(DEPARTMENT)
3731
- organisation_configs OrganisationConfig[]
3732
- activity_events ActivityEvent[]
3733
- usage_ledger_entries UsageLedgerEntry[]
3734
- usage_aggregates UsageAggregate[]
3735
- channel_provider_configs ChannelProviderConfig[]
3736
- conversations Conversation[]
3737
- communication_messages CommunicationMessage[]
3738
- job_application_fields JobApplicationField[]
3739
- documents Document[]
3740
- job_application_templates JobApplicationTemplate[]
3741
- offer_letter_templates OfferLetterTemplate[]
3742
- offers Offer[]
3743
- sources Source[]
3744
- evaluation_criteria EvaluationCriteria[]
3745
- departments Department[]
3746
- hiring_plans HiringPlan[]
3747
- employees Employee[]
3748
- competency_dictionaries CompetencyDictionary[]
3749
- purchased_license_packages PurchasedLicensePackage[]
3750
- purchased_hiring_units PurchasedHiringUnit[]
3751
- purchased_top_ups PurchasedTopUp[]
3752
- licensing_ledger_entries LicensingLedgerEntry[]
3753
- license_package_organisations LicensePackageOrganisation[]
3754
- ai_cost_ledger_entries AiCostLedgerEntry[]
3755
- billing_transactions BillingTransaction[]
3756
- payment_webhook_events PaymentWebhookEvent[]
3806
+ hiring_unit_assignment_scope HiringUnitAssignmentScope @default(DEPARTMENT)
3807
+ organisation_configs OrganisationConfig[]
3808
+ activity_events ActivityEvent[]
3809
+ usage_ledger_entries UsageLedgerEntry[]
3810
+ usage_aggregates UsageAggregate[]
3811
+ channel_provider_configs ChannelProviderConfig[]
3812
+ conversations Conversation[]
3813
+ communication_messages CommunicationMessage[]
3814
+ job_application_fields JobApplicationField[]
3815
+ documents Document[]
3816
+ job_application_templates JobApplicationTemplate[]
3817
+ offer_letter_templates OfferLetterTemplate[]
3818
+ offers Offer[]
3819
+ sources Source[]
3820
+ evaluation_criteria EvaluationCriteria[]
3821
+ departments Department[]
3822
+ hiring_plans HiringPlan[]
3823
+ employees Employee[]
3824
+ competency_dictionaries CompetencyDictionary[]
3825
+ purchased_license_packages PurchasedLicensePackage[]
3826
+ purchased_hiring_units PurchasedHiringUnit[]
3827
+ purchased_top_ups PurchasedTopUp[]
3828
+ licensing_ledger_entries LicensingLedgerEntry[]
3829
+ license_package_organisations LicensePackageOrganisation[]
3830
+ ai_cost_ledger_entries AiCostLedgerEntry[]
3831
+ consent_documents ConsentDocument[]
3832
+ /// Deprecated — migrate to org-scoped ConsentDocument; kept for legacy S3 fallback until backfill completes
3833
+ has_custom_consent Boolean @default(false)
3834
+ consent_s3_bucket String?
3835
+ consent_s3_region String?
3836
+ custom_interview_consent_s3_key_prefix String?
3757
3837
 
3758
3838
  @@index([name])
3759
3839
  @@schema("public")
@@ -3773,119 +3853,6 @@ model OrganisationConfig {
3773
3853
  @@schema("public")
3774
3854
  }
3775
3855
 
3776
- // PAYMENT SERVICE boundary — portable payment microservice owns these enums/columns.
3777
-
3778
- enum BillingTransactionStatus {
3779
- INITIATED
3780
- ORDER_CREATED
3781
- PAYMENT_PENDING
3782
- SUCCESS
3783
- FAILED
3784
- CANCELLED
3785
- REFUND_PENDING
3786
- REFUND_FAILED
3787
- REFUNDED
3788
-
3789
- @@schema("public")
3790
- }
3791
-
3792
- enum BillingTransactionType {
3793
- PURCHASE
3794
- TOP_UP
3795
- REFUND
3796
-
3797
- @@schema("public")
3798
- }
3799
-
3800
- enum BillingTransactionFailureCategory {
3801
- RAZORPAY_ORDER
3802
- RAZORPAY_PAYMENT
3803
- REFUND
3804
- INTERNAL
3805
-
3806
- @@schema("public")
3807
- }
3808
-
3809
- /// Payment reconciliation state when Treadspace status is FAILED but Razorpay captured payment.
3810
- enum BillingPaymentMismatchStatus {
3811
- DETECTED
3812
- UNFULFILLED
3813
-
3814
- @@schema("public")
3815
- }
3816
-
3817
- /// Financial transaction lifecycle for organisation billing purchases.
3818
- model BillingTransaction {
3819
- id String @id @default(uuid())
3820
- organisation_id String
3821
- /// Opaque plan/product identity supplied at checkout. Not a catalog FK.
3822
- purchase_reference String
3823
- /// Human-readable snapshot captured at checkout for invoices and receipts.
3824
- purchase_display_name String?
3825
- transaction_type BillingTransactionType
3826
- status BillingTransactionStatus @default(INITIATED)
3827
- failure_category BillingTransactionFailureCategory?
3828
- /// Human-readable or provider detail (e.g. Razorpay error_description).
3829
- failure_reason String?
3830
- amount Int
3831
- currency String @default("INR")
3832
- razorpay_order_id String?
3833
- razorpay_payment_id String? @unique
3834
- /// Razorpay payment method at capture (card, netbanking, upi, wallet, etc.).
3835
- payment_method String?
3836
- razorpay_subscription_id String?
3837
- razorpay_refund_id String?
3838
- refund_reason String?
3839
- refund_amount Int?
3840
- idempotency_key String @unique
3841
- invoice_number String? @unique
3842
- /// Email of the org Admin who initiated checkout (bill-to).
3843
- purchaser_email String?
3844
- /// Set when FAILED but Razorpay order/payment is captured (reconciliation path).
3845
- payment_mismatch_status BillingPaymentMismatchStatus?
3846
- /// Strict same-intent SUCCESS transaction that fulfilled the purchase (UNFULFILLED only).
3847
- payment_mismatch_fulfilled_by_id String?
3848
- created_at DateTime @default(now())
3849
- updated_at DateTime @updatedAt
3850
-
3851
- organisation Organisation @relation(fields: [organisation_id], references: [id])
3852
-
3853
- @@index([organisation_id, status])
3854
- @@index([purchase_reference])
3855
- @@index([razorpay_order_id])
3856
- @@map("billing_transactions")
3857
- @@schema("public")
3858
- }
3859
-
3860
- enum PaymentWebhookEventStatus {
3861
- RECEIVED
3862
- PROCESSED
3863
- FAILED
3864
-
3865
- @@schema("public")
3866
- }
3867
-
3868
- /// Idempotent record of payment provider webhook deliveries.
3869
- model PaymentWebhookEvent {
3870
- id String @id @default(uuid())
3871
- organisation_id String?
3872
- provider String
3873
- provider_event_id String
3874
- event_type String
3875
- status PaymentWebhookEventStatus @default(RECEIVED)
3876
- billing_transaction_id String?
3877
- error_message String?
3878
- processed_at DateTime?
3879
- created_at DateTime @default(now())
3880
-
3881
- organisation Organisation? @relation(fields: [organisation_id], references: [id])
3882
-
3883
- @@unique([provider, provider_event_id])
3884
- @@index([status, created_at])
3885
- @@map("payment_webhook_events")
3886
- @@schema("public")
3887
- }
3888
-
3889
3856
  model Permission {
3890
3857
  id String @id @default(uuid())
3891
3858
  permissions String[] @default([])
@@ -4899,11 +4866,13 @@ model User {
4899
4866
  employee_number Int?
4900
4867
  employee_code String? @unique
4901
4868
 
4902
- department_members DepartmentMember[] @relation("DepartmentMemberships")
4903
- assigned_hiring_units PurchasedHiringUnit[] @relation("AssignedHiringUnits")
4904
- consent_records ConsentRecord[]
4905
- erasure_requests_as_subject DataErasureRequest[] @relation("ErasureSubjectUser")
4906
- erasure_requests_requested DataErasureRequest[] @relation("ErasureRequestedByUser")
4869
+ department_members DepartmentMember[] @relation("DepartmentMemberships")
4870
+ assigned_hiring_units PurchasedHiringUnit[] @relation("AssignedHiringUnits")
4871
+ consent_records ConsentRecord[]
4872
+ consent_versions_published ConsentDocumentVersion[] @relation("ConsentVersionPublishedBy")
4873
+ consent_version_approval_actions ConsentDocumentVersionApproval[] @relation("ConsentVersionApprovalActor")
4874
+ erasure_requests_as_subject DataErasureRequest[] @relation("ErasureSubjectUser")
4875
+ erasure_requests_requested DataErasureRequest[] @relation("ErasureRequestedByUser")
4907
4876
 
4908
4877
  @@index([role_id])
4909
4878
  @@index([permission_id])