@adaptware/eagles-db 0.6.1 → 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.
@@ -519,6 +519,8 @@ model Assessment {
519
519
  /// Attempt Expires At
520
520
  attempt_expires_at DateTime?
521
521
  evaluated_at DateTime?
522
+ /// When this moves forward, prior INTERVIEW_SESSION grants with reference ASSESSMENT are stale.
523
+ consent_epoch_at DateTime @default(now())
522
524
  /// Audit fields
523
525
  created_at DateTime @default(now())
524
526
  updated_at DateTime @updatedAt
@@ -1201,6 +1203,8 @@ enum CompetencyCategory {
1201
1203
  AI
1202
1204
  /// FitCheck analysis only — not a dictionary / job-profile catalog category.
1203
1205
  EXPERIENCE_RELEVANCE
1206
+ SOFT_SKILLS
1207
+ CULTURE_FIT
1204
1208
 
1205
1209
  @@schema("public")
1206
1210
  }
@@ -1244,6 +1248,214 @@ model CompetencyDictionary {
1244
1248
  @@schema("public")
1245
1249
  }
1246
1250
 
1251
+ /// Candidate consent catalog, audit records, and erasure planning (dry-run v1).
1252
+
1253
+ enum ConsentType {
1254
+ PLATFORM_TERMS
1255
+ INTERVIEW_SESSION
1256
+ /// Read-only catalog document; no ConsentRecord submit flow
1257
+ PRIVACY_POLICY
1258
+
1259
+ @@schema("public")
1260
+ }
1261
+
1262
+ enum ConsentReferenceType {
1263
+ INTERVIEW
1264
+ ASSESSMENT
1265
+
1266
+ @@schema("public")
1267
+ }
1268
+
1269
+ enum ConsentOutcome {
1270
+ GRANTED
1271
+ DECLINED
1272
+
1273
+ @@schema("public")
1274
+ }
1275
+
1276
+ enum DataErasureTrigger {
1277
+ ADMIN
1278
+ USER_REQUEST
1279
+ RETENTION_POLICY
1280
+ CONSENT_WITHDRAWAL
1281
+
1282
+ @@schema("public")
1283
+ }
1284
+
1285
+ enum DataErasureMode {
1286
+ DRY_RUN
1287
+ EXECUTE
1288
+
1289
+ @@schema("public")
1290
+ }
1291
+
1292
+ enum DataErasureRequestStatus {
1293
+ PLANNED
1294
+ APPROVED
1295
+ EXECUTED
1296
+ REJECTED
1297
+ FAILED
1298
+
1299
+ @@schema("public")
1300
+ }
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
+
1313
+ model ConsentDocument {
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[]
1326
+
1327
+ @@unique([organisation_id, slug])
1328
+ @@index([consent_type, organisation_id, is_active])
1329
+ @@schema("public")
1330
+ }
1331
+
1332
+ model ConsentDocumentVersion {
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[]
1366
+
1367
+ @@unique([document_id, version_number])
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)])
1384
+ @@schema("public")
1385
+ }
1386
+
1387
+ model ConsentCheckboxDefinition {
1388
+ id String @id @default(uuid())
1389
+ document_version_id String
1390
+ document_version ConsentDocumentVersion @relation(fields: [document_version_id], references: [id], onDelete: Cascade)
1391
+ /// Stable machine key in ConsentRecord.selections JSON
1392
+ checkbox_key String
1393
+ label String
1394
+ sort_order Int @default(0)
1395
+ default_required_hint Boolean @default(true)
1396
+
1397
+ @@unique([document_version_id, checkbox_key])
1398
+ @@schema("public")
1399
+ }
1400
+
1401
+ model ConsentRecord {
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())
1421
+
1422
+ @@index([user_id, consent_type, created_at(sort: Desc)])
1423
+ @@index([reference_type, reference_id, consent_type, created_at(sort: Desc)])
1424
+ @@schema("public")
1425
+ }
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
+
1441
+ /// Append-only erasure plan snapshots (v1: DRY_RUN only in application code).
1442
+ model DataErasureRequest {
1443
+ id String @id @default(uuid())
1444
+ subject_user_id String
1445
+ subject_user User @relation("ErasureSubjectUser", fields: [subject_user_id], references: [id], onDelete: Cascade)
1446
+ trigger DataErasureTrigger
1447
+ mode DataErasureMode @default(DRY_RUN)
1448
+ status DataErasureRequestStatus @default(PLANNED)
1449
+ plan Json @default("{}")
1450
+ planner_version String
1451
+ requested_by_id String?
1452
+ requested_by User? @relation("ErasureRequestedByUser", fields: [requested_by_id], references: [id], onDelete: SetNull)
1453
+ created_at DateTime @default(now())
1454
+
1455
+ @@index([subject_user_id, created_at(sort: Desc)])
1456
+ @@schema("public")
1457
+ }
1458
+
1247
1459
  model ContactUs {
1248
1460
  id String @id @default(uuid())
1249
1461
  first_name String
@@ -1408,6 +1620,7 @@ model Document {
1408
1620
  offer_letter_template_snapshots OfferLetter[] @relation("OfferLetterTemplateSnapshot")
1409
1621
  offer_draft_edited_html Offer[] @relation("OfferDraftEditedHtml")
1410
1622
  application_fit_check_report Application? @relation("ApplicationFitCheckReportDocument")
1623
+ consent_document_versions ConsentDocumentVersion[]
1411
1624
 
1412
1625
  // Indexes
1413
1626
  @@index([candidate_id])
@@ -1476,6 +1689,7 @@ enum EvaluationType {
1476
1689
  TREADSPACE_FULL_AI
1477
1690
  EXTERNAL_AI_ASSISTED
1478
1691
  NON_AI_ASSISTED
1692
+ IN_PERSON
1479
1693
 
1480
1694
  @@schema("public")
1481
1695
  }
@@ -1580,7 +1794,8 @@ model FitCheck {
1580
1794
  application_id String? @unique
1581
1795
  skills_analysis Json?
1582
1796
  overall_analysis Json?
1583
- overall_score Float
1797
+ /// Optional; new FitChecks from Orion omit a numeric score.
1798
+ overall_score Float?
1584
1799
  /// Free-text from Overall Analysis agent; preferred over recommendation Json.
1585
1800
  overall_recommendation String?
1586
1801
  /// Why `overall_score` is this value. Distinct from `overall_recommendation`.
@@ -2001,6 +2216,7 @@ model Interview {
2001
2216
  recording_url String?
2002
2217
  recording_document_id String? @unique
2003
2218
  evaluation_type EvaluationType? @default(TREADSPACE_AI_ASSISTED)
2219
+ is_proctored Boolean @default(false) @map("is_proctored")
2004
2220
  ai_assistance_mode AiAssistanceMode? @default(ASSISTED)
2005
2221
  interview_status InterviewStatus @default(SCHEDULED)
2006
2222
  interview_platform InterviewPlatform @default(TREADSPACE)
@@ -2013,6 +2229,9 @@ model Interview {
2013
2229
  final_feedback Json?
2014
2230
  interview_analysis_ranges Json?
2015
2231
  interview_flow_summary String?
2232
+ transcript_summary String?
2233
+ body_language_appropriate Boolean?
2234
+ tone_appropriate Boolean?
2016
2235
  /// Extra Orion prose for downstream AI input (FitCheck, interview prep).
2017
2236
  /// Not interviewer-facing; omit from evidence GET / snapshots / Zoho.
2018
2237
  ai_context String?
@@ -2031,36 +2250,47 @@ model Interview {
2031
2250
  /// When final human feedback was submitted.
2032
2251
  evaluated_at DateTime?
2033
2252
 
2253
+ /// Candidate invite response (legal consent in ConsentRecord).
2254
+ candidate_status String? @default("INVITED")
2255
+ candidate_responded_at DateTime?
2256
+ decline_reason String?
2257
+ /// When this timestamp moves forward, prior INTERVIEW_SESSION consent grants are stale.
2258
+ consent_epoch_at DateTime @default(now())
2259
+
2034
2260
  /// Self-scheduling
2035
- reschedule_count Int @default(0)
2261
+ reschedule_count Int @default(0)
2036
2262
  last_rescheduled_at DateTime?
2037
2263
  first_assigned_at DateTime?
2038
2264
  /// True while the candidate is waiting on recruiter action (typically a
2039
2265
  /// reassign) after they submitted alternate slots via "None match" /
2040
2266
  /// "Suggest times". Cleared whenever the recruiter routes a fresh
2041
2267
  /// request via `upsertInterviewRequestRecord`.
2042
- awaiting_recruiter_action Boolean @default(false)
2268
+ awaiting_recruiter_action Boolean @default(false)
2043
2269
  /// Audit fields
2044
- created_at DateTime @default(now())
2045
- updated_at DateTime @updatedAt
2270
+ created_at DateTime @default(now())
2271
+ updated_at DateTime @updatedAt
2046
2272
  created_by String
2047
2273
  updated_by String
2048
- is_active Boolean @default(true)
2274
+ is_active Boolean @default(true)
2275
+
2276
+ //interview proctoring
2277
+ proctoringSession ProctoringSession?
2278
+
2049
2279
  // Relations
2050
- candidate User? @relation("CandidateInterviews", fields: [candidate_id], references: [id], onDelete: SetNull)
2051
- interviewer User? @relation("InterviewerInterviews", fields: [interviewer_id], references: [id], onDelete: SetNull)
2052
- organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2053
- recording_document Document? @relation(fields: [recording_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2054
- job_description JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2055
- resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2056
- evaluation_plan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2057
- application Application? @relation(fields: [application_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2058
- ongoing_evaluation OngoingEvaluation?
2059
- transcripts Transcript[]
2060
- suggestions Suggestion[]
2061
- interviewNotes InterviewNotes[]
2062
- liveAnalysis LiveAnalysis[]
2063
- zoom_meeting ZoomMeeting?
2280
+ candidate User? @relation("CandidateInterviews", fields: [candidate_id], references: [id], onDelete: SetNull)
2281
+ interviewer User? @relation("InterviewerInterviews", fields: [interviewer_id], references: [id], onDelete: SetNull)
2282
+ organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2283
+ recording_document Document? @relation(fields: [recording_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2284
+ job_description JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2285
+ resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2286
+ evaluation_plan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2287
+ application Application? @relation(fields: [application_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2288
+ ongoing_evaluation OngoingEvaluation?
2289
+ transcripts Transcript[]
2290
+ suggestions Suggestion[]
2291
+ interviewNotes InterviewNotes[]
2292
+ liveAnalysis LiveAnalysis[]
2293
+ zoom_meeting ZoomMeeting?
2064
2294
 
2065
2295
  // Indexes
2066
2296
  @@index([candidate_id])
@@ -2509,46 +2739,47 @@ model JobDescription {
2509
2739
  closing_date DateTime?
2510
2740
  opened_at DateTime?
2511
2741
 
2512
- job_number Int?
2513
- job_code String? @unique
2742
+ job_number Int?
2743
+ job_code String? @unique
2514
2744
  // Audit fields
2515
- created_at DateTime @default(now())
2516
- updated_at DateTime @updatedAt
2517
- created_by String
2518
- updated_by String
2519
- is_active Boolean @default(true)
2520
- openings Int @default(1)
2521
- job_profile_id String?
2522
- job_profile JobProfile? @relation(fields: [job_profile_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2523
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2524
- department Department? @relation(fields: [department_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2525
- source_document Document? @relation("SourceDocument", fields: [source_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2526
- applications Application[]
2527
- interviews Interview[]
2528
- assignments Assignment[]
2529
- fit_check FitCheck[] // one-to-many link
2530
- job_description_data JobDescriptionData[] // one-to-many link
2531
- evaluationPlan EvaluationPlan[] // relation to evaluation methods
2532
- ongoing_evaluations OngoingEvaluation[] // optional one-to-many
2533
- assignment_library AssignmentLibrary[]
2534
- approvals Approval[] // one-to-many relation
2535
- resumes Resume[] // one-to-many link
2536
- budget Budget?
2537
- hiring_manager User? @relation("HiringManager", fields: [hiring_manager_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2538
- recruiters User[]
2539
- transcripts Transcript[]
2540
- integration_job_syncs IntegrationJobSync[]
2541
- job_application_template JobApplicationTemplate?
2542
- offer_letter_templates OfferLetterTemplate[]
2543
- offers Offer[]
2544
- conversations Conversation[]
2545
- 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[]
2546
2777
  /// Plan line this opening is committed against (requisition → plan).
2547
- hiring_plan_line_id String?
2548
- 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)
2549
2780
  /// Plan lines that use this JD as the role template/reference.
2550
- referenced_by_plan_lines HiringPlanLine[] @relation("PlanLineTemplateJd")
2551
- linked_hiring_units PurchasedHiringUnit[]
2781
+ referenced_by_plan_lines HiringPlanLine[] @relation("PlanLineTemplateJd")
2782
+ linked_hiring_units PurchasedHiringUnit[]
2552
2783
 
2553
2784
  @@index([organisation_id])
2554
2785
  @@index([hiring_manager_id])
@@ -3530,73 +3761,79 @@ enum HiringUnitAssignmentScope {
3530
3761
  }
3531
3762
 
3532
3763
  model Organisation {
3533
- id String @id @default(uuid())
3534
- name String @unique
3535
- industry String
3536
- about String
3537
- website String
3538
- size OrganisationSize @default(ONE_TO_TEN)
3539
- phone String
3540
- address String
3541
- company_values Json[]
3542
- allowed_email_domains String[]
3543
- send_email Boolean @default(true)
3544
- interviewers User[]
3545
- created_at DateTime @default(now())
3546
- updated_at DateTime @updatedAt
3547
- created_by String
3548
- updated_by String
3549
- is_active Boolean @default(true)
3550
- alias String? @unique
3551
- logo String?
3552
- job_sequence Int @default(1)
3553
- employee_sequence Int @default(1)
3554
- applications Application[]
3555
- user_roles UserRole[]
3556
- job_descriptions JobDescription[]
3557
- job_profiles JobProfile[]
3558
- assessment_library AssessmentLibrary[]
3559
- assignment_library AssignmentLibrary[]
3560
- interviews Interview[]
3561
- assignments Assignment[]
3562
- fit_check FitCheck[] // one-to-many link
3563
- resumes Resume[] // one-to-many link
3564
- approvals Approval[] // one-to-many link
3565
- suggestions Suggestion[]
3566
- ongoing_evaluations OngoingEvaluation[] // optional one-to-many
3567
- actions Action[]
3568
- integration_credentials IntegrationCredential[]
3569
- zoho_sync_mappings ZohoSyncMapping[]
3570
- assessments Assessment[]
3571
- 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")
3572
3803
  /// ISO 3166-1 alpha-2 (e.g. IN).
3573
- country_code String @default("IN")
3804
+ country_code String @default("IN")
3574
3805
  /// Who may consume unused hiring units. Does not rewrite unit rows when changed.
3575
- hiring_unit_assignment_scope HiringUnitAssignmentScope @default(DEPARTMENT)
3576
- organisation_configs OrganisationConfig[]
3577
- activity_events ActivityEvent[]
3578
- usage_ledger_entries UsageLedgerEntry[]
3579
- usage_aggregates UsageAggregate[]
3580
- channel_provider_configs ChannelProviderConfig[]
3581
- conversations Conversation[]
3582
- communication_messages CommunicationMessage[]
3583
- job_application_fields JobApplicationField[]
3584
- documents Document[]
3585
- job_application_templates JobApplicationTemplate[]
3586
- offer_letter_templates OfferLetterTemplate[]
3587
- offers Offer[]
3588
- sources Source[]
3589
- evaluation_criteria EvaluationCriteria[]
3590
- departments Department[]
3591
- hiring_plans HiringPlan[]
3592
- employees Employee[]
3593
- competency_dictionaries CompetencyDictionary[]
3594
- purchased_license_packages PurchasedLicensePackage[]
3595
- purchased_hiring_units PurchasedHiringUnit[]
3596
- purchased_top_ups PurchasedTopUp[]
3597
- licensing_ledger_entries LicensingLedgerEntry[]
3598
- license_package_organisations LicensePackageOrganisation[]
3599
- ai_cost_ledger_entries AiCostLedgerEntry[]
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?
3600
3837
 
3601
3838
  @@index([name])
3602
3839
  @@schema("public")
@@ -3702,6 +3939,125 @@ model PipelineDistributionAnalyticsDaily {
3702
3939
  @@schema("analytics")
3703
3940
  }
3704
3941
 
3942
+ enum RiskLevel {
3943
+ LOW
3944
+ MEDIUM
3945
+ HIGH
3946
+ CRITICAL
3947
+
3948
+ @@schema("public")
3949
+ }
3950
+
3951
+ enum AnalysisStatus {
3952
+ QUEUED
3953
+ RUNNING
3954
+ COMPLETED
3955
+ FAILED
3956
+
3957
+ @@schema("public")
3958
+ }
3959
+
3960
+ enum ProctoringEventType {
3961
+ GAZE_DISRUPTION
3962
+ OBJECT_DETECTED
3963
+ FACE_MISSING
3964
+ MULTIPLE_FACES
3965
+ BROWSER_TAB_SWITCH
3966
+ BROWSER_BLUR
3967
+ FULLSCREEN_EXIT
3968
+
3969
+ @@schema("public")
3970
+ }
3971
+
3972
+ enum ProctoringSessionStatus {
3973
+ NOT_STARTED
3974
+ CALIBRATING
3975
+ CALIBRATED
3976
+ PROCESSING
3977
+ COMPLETED
3978
+ FAILED
3979
+
3980
+ @@schema("public")
3981
+ }
3982
+
3983
+ model ProctoringSession {
3984
+ id String @id @default(uuid()) @map("id")
3985
+ interviewId String @unique @map("interview_id")
3986
+ interview Interview @relation(fields: [interviewId], references: [id], onDelete: Cascade)
3987
+
3988
+ // Proctoring Lifecycle & Media
3989
+ status ProctoringSessionStatus @default(NOT_STARTED) @map("status")
3990
+ calibrationFeatures Json? @map("calibration_features")
3991
+ chunkCount Int @default(0) @map("chunk_count")
3992
+ completedChunks Int @default(0) @map("completed_chunks")
3993
+
3994
+ // High-Level Aggregated Metrics for Downstream AI Evaluation
3995
+ overallRisk RiskLevel @default(LOW) @map("overall_risk")
3996
+ integrityScore Float @default(100.0) @map("integrity_score")
3997
+
3998
+ totalDurationSec Float @default(0.0) @map("total_duration_sec")
3999
+ faceDetectedPct Float? @map("face_detected_pct")
4000
+ onScreenGazePct Float? @map("on_screen_gaze_pct")
4001
+
4002
+ // Event Counters
4003
+ totalGazeEvents Int @default(0) @map("total_gaze_events")
4004
+ totalObjectEvents Int @default(0) @map("total_object_events")
4005
+ totalFaceEvents Int @default(0) @map("total_face_events")
4006
+ totalBrowserEvents Int @default(0) @map("total_browser_events")
4007
+
4008
+ createdAt DateTime @default(now()) @map("created_at")
4009
+ updatedAt DateTime @updatedAt @map("updated_at")
4010
+
4011
+ analyses ProctoringAnalysis[]
4012
+ events ProctoringEvent[]
4013
+
4014
+ @@map("proctoring_sessions")
4015
+ @@schema("public")
4016
+ }
4017
+
4018
+ model ProctoringAnalysis {
4019
+ id String @id @default(uuid()) @map("id")
4020
+ sessionId String @map("session_id")
4021
+ session ProctoringSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)
4022
+
4023
+ status AnalysisStatus @default(QUEUED)
4024
+
4025
+ chunkIndex Int @default(0) @map("chunk_index")
4026
+ startTimeSec Float @default(0.0) @map("start_time_sec")
4027
+ endTimeSec Float @default(0.0) @map("end_time_sec")
4028
+
4029
+ videoKey String? @map("video_key")
4030
+ annotatedKey String? @map("annotated_key")
4031
+
4032
+ error String?
4033
+ createdAt DateTime @default(now()) @map("created_at")
4034
+ updatedAt DateTime @updatedAt @map("updated_at")
4035
+
4036
+ @@unique([sessionId, chunkIndex])
4037
+ @@map("proctoring_analyses")
4038
+ @@schema("public")
4039
+ }
4040
+
4041
+ model ProctoringEvent {
4042
+ id String @id @default(uuid()) @map("id")
4043
+ sessionId String @map("session_id")
4044
+ session ProctoringSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)
4045
+
4046
+ eventType ProctoringEventType @map("event_type")
4047
+ timestampSec Float @map("timestamp_sec")
4048
+ timestampStr String @map("timestamp_str")
4049
+
4050
+ risk RiskLevel @default(LOW)
4051
+ metadata Json?
4052
+
4053
+ createdAt DateTime @default(now()) @map("created_at")
4054
+
4055
+ @@index([sessionId, timestampSec])
4056
+ @@index([sessionId, eventType])
4057
+ @@map("proctoring_events")
4058
+ @@schema("public")
4059
+ }
4060
+
3705
4061
  enum AsyncOperationStatus {
3706
4062
  PENDING
3707
4063
  IN_PROGRESS
@@ -4510,8 +4866,13 @@ model User {
4510
4866
  employee_number Int?
4511
4867
  employee_code String? @unique
4512
4868
 
4513
- department_members DepartmentMember[] @relation("DepartmentMemberships")
4514
- assigned_hiring_units PurchasedHiringUnit[] @relation("AssignedHiringUnits")
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")
4515
4876
 
4516
4877
  @@index([role_id])
4517
4878
  @@index([permission_id])