@adaptware/eagles-db 0.4.36 → 0.4.37

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 (86) hide show
  1. package/client/edge.js +874 -10
  2. package/client/index-browser.js +905 -40
  3. package/client/index.d.ts +81912 -27565
  4. package/client/index.js +874 -10
  5. package/client/libquery_engine-darwin.dylib.node +0 -0
  6. package/client/package.json +1 -1
  7. package/client/schema.prisma +1584 -108
  8. package/client/wasm.js +874 -10
  9. package/package.json +1 -1
  10. package/prisma/.DS_Store +0 -0
  11. package/prisma/migrations/20260519120000_migrate_shortlisted_to_selected/migration.sql +2 -0
  12. package/prisma/schema/.DS_Store +0 -0
  13. package/prisma/schema/CandidateQuestionResponse.prisma +1 -0
  14. package/prisma/schema/UserRole.prisma +1 -0
  15. package/prisma/schema/action.prisma +5 -0
  16. package/prisma/schema/activityEvent.prisma +138 -0
  17. package/prisma/schema/activityLog.prisma +3 -0
  18. package/prisma/schema/applicationAnalytics.prisma +87 -0
  19. package/prisma/schema/applications.prisma +12 -2
  20. package/prisma/schema/approval.prisma +2 -0
  21. package/prisma/schema/assessment.prisma +1 -0
  22. package/prisma/schema/assessmentLibrary.prisma +1 -0
  23. package/prisma/schema/assessmentQuestion.prisma +1 -0
  24. package/prisma/schema/assessmentRoundAnalytics.prisma +119 -0
  25. package/prisma/schema/assignment.prisma +3 -0
  26. package/prisma/schema/assignmentLibrary.prisma +1 -0
  27. package/prisma/schema/assignmentRoundAnalytics.prisma +109 -0
  28. package/prisma/schema/authModule.prisma +3 -0
  29. package/prisma/schema/budget.prisma +6 -0
  30. package/prisma/schema/calendly.prisma +2 -0
  31. package/prisma/schema/candidateProfile.prisma +2 -0
  32. package/prisma/schema/communication.prisma +11 -0
  33. package/prisma/schema/contactUs.prisma +2 -0
  34. package/prisma/schema/document.prisma +5 -4
  35. package/prisma/schema/evaluationPlan.prisma +35 -10
  36. package/prisma/schema/feedback.prisma +1 -0
  37. package/prisma/schema/fitCheck.prisma +3 -0
  38. package/prisma/schema/google.prisma +2 -0
  39. package/prisma/schema/integration.prisma +13 -0
  40. package/prisma/schema/interview.prisma +9 -0
  41. package/prisma/schema/interviewNotes.prisma +1 -0
  42. package/prisma/schema/interviewRoundAnalytics.prisma +140 -0
  43. package/prisma/schema/interviewerAnalytics.prisma +129 -0
  44. package/prisma/schema/jobApplicationFields.prisma +3 -0
  45. package/prisma/schema/jobApplicationResponse.prisma +1 -0
  46. package/prisma/schema/jobApplicationTemplate.prisma +3 -0
  47. package/prisma/schema/jobDescription.prisma +43 -35
  48. package/prisma/schema/jobDescriptionData.prisma +1 -0
  49. package/prisma/schema/jobProfile.prisma +3 -0
  50. package/prisma/schema/jobRoundAnalytics.prisma +101 -0
  51. package/prisma/schema/liveAnalysis.prisma +1 -0
  52. package/prisma/schema/message.prisma +2 -0
  53. package/prisma/schema/migrations/20260519120000_add_analytics_schema/migration.sql +84 -0
  54. package/prisma/schema/migrations/20260625120000_add_interviewer_analytics/migration.sql +26 -0
  55. package/prisma/schema/migrations/20260629120000_add_user_lifecycle_activity_events/migration.sql +13 -0
  56. package/prisma/schema/migrations/20260629140000_drop_organisation_org_code/migration.sql +2 -0
  57. package/prisma/schema/migrations/20260629160000_employee_codes_dual_interviewer_analytics/migration.sql +87 -0
  58. package/prisma/schema/migrations/20260630120000_add_application_sources/migration.sql +38 -0
  59. package/prisma/schema/migrations/20260701120000_add_source_effectiveness_analytics/migration.sql +40 -0
  60. package/prisma/schema/migrations/20260702120000_add_analytics_daily_tables/migration.sql +232 -0
  61. package/prisma/schema/migrations/{20260710120000_add_resume_rendered_export_fields → 20260706120000_add_resume_rendered_export}/migration.sql +5 -2
  62. package/prisma/schema/notes.prisma +1 -0
  63. package/prisma/schema/ongoingEvaluation.prisma +7 -0
  64. package/prisma/schema/openJobAnalytics.prisma +85 -0
  65. package/prisma/schema/organisation.prisma +39 -31
  66. package/prisma/schema/organisationConfig.prisma +1 -0
  67. package/prisma/schema/permission.prisma +1 -0
  68. package/prisma/schema/pipelineDistributionAnalytics.prisma +64 -0
  69. package/prisma/schema/promise.prisma +3 -0
  70. package/prisma/schema/questions.prisma +4 -0
  71. package/prisma/schema/refreshToken.prisma +2 -0
  72. package/prisma/schema/reportingOverviewJobAnalytics.prisma +49 -0
  73. package/prisma/schema/resume.prisma +5 -4
  74. package/prisma/schema/resumeData.prisma +1 -0
  75. package/prisma/schema/roundAnalytics.prisma +145 -0
  76. package/prisma/schema/schema.prisma +2 -0
  77. package/prisma/schema/source.prisma +36 -0
  78. package/prisma/schema/sourceEffectivenessAnalytics.prisma +79 -0
  79. package/prisma/schema/suggestion.prisma +1 -0
  80. package/prisma/schema/transcript.prisma +1 -0
  81. package/prisma/schema/user.prisma +10 -0
  82. package/prisma/schema/userProfile.prisma +2 -0
  83. package/prisma/schema/zoomMeeting.prisma +5 -0
  84. package/prisma/schema/migrations/20260522120000_ongoing_evaluation_record_kind/migration.sql +0 -25
  85. package/prisma/schema/migrations/20260523120000_replace_record_kind_with_is_committed/migration.sql +0 -24
  86. package/prisma/schema/migrations/20260528120000_drop_job_description_recommendation_config/migration.sql +0 -2
@@ -21,6 +21,7 @@ model CandidateQuestionResponse {
21
21
  @@unique([assessment_id, question_id, candidate_id])
22
22
  @@index([candidate_id])
23
23
  @@index([assessment_id])
24
+ @@schema("public")
24
25
  }
25
26
 
26
27
  model UserRole {
@@ -42,18 +43,23 @@ model UserRole {
42
43
  @@index([role, organisation_id])
43
44
  @@index([organisation_id])
44
45
  @@index([permission_id])
46
+ @@schema("public")
45
47
  }
46
48
 
47
49
  enum ActionType {
48
50
  TAKE_INTERVIEW
49
51
  PROVIDE_FEEDBACK
50
52
  SCHEDULE_INTERVIEW
53
+
54
+ @@schema("public")
51
55
  }
52
56
 
53
57
  enum ActionStatus {
54
58
  PENDING
55
59
  COMPLETED
56
60
  CANCELLED
61
+
62
+ @@schema("public")
57
63
  }
58
64
 
59
65
  model Action {
@@ -78,12 +84,154 @@ model Action {
78
84
  @@index([assignee_id, action_type])
79
85
  @@index([status])
80
86
  @@index([due_date])
87
+ @@schema("public")
88
+ }
89
+
90
+ enum ActivityEventType {
91
+ APPLICATION_CREATED
92
+ APPLICATION_STARTED
93
+ APPLICATION_REJECTED
94
+ APPLICATION_SHORTLISTED
95
+
96
+ FIT_CHECK_COMPLETED
97
+
98
+ ROUND_ASSIGNED
99
+ ROUND_COMPLETED
100
+ ROUND_PASSED
101
+ ROUND_FAILED
102
+
103
+ INTERVIEW_CREATED
104
+ INTERVIEW_SCHEDULED
105
+ INTERVIEW_RESCHEDULED
106
+ INTERVIEW_CANCELLED
107
+ INTERVIEW_STARTED
108
+ INTERVIEW_COMPLETED
109
+ INTERVIEW_NO_SHOW
110
+ INTERVIEW_EVALUATION_PENDING
111
+ INTERVIEW_EVALUATED
112
+
113
+ FEEDBACK_SUBMITTED
114
+
115
+ ASSIGNMENT_CREATED
116
+ ASSIGNMENT_STARTED
117
+ ASSIGNMENT_COMPLETED
118
+ ASSIGNMENT_CANCELLED
119
+ ASSIGNMENT_EVALUATED
120
+
121
+ ASSESSMENT_CREATED
122
+ ASSESSMENT_STARTED
123
+ ASSESSMENT_COMPLETED
124
+ ASSESSMENT_CANCELLED
125
+ ASSESSMENT_EVALUATED
126
+
127
+ JOB_CREATED
128
+ JOB_PUBLISHED
129
+ JOB_CLOSED
130
+ JOB_DEACTIVATED
131
+
132
+ USER_INVITED
133
+ USER_INVITATION_RESENT
134
+ USER_CREATED
135
+ USER_INVITATION_ACCEPTED
136
+ USER_INVITATION_EXPIRED
137
+ USER_DEACTIVATED
138
+ USER_REACTIVATED
139
+ USER_ROLE_CHANGED
140
+ USER_PROFILE_COMPLETED
141
+
142
+ CANDIDATE_REGISTERED
143
+ CANDIDATE_CREATED
144
+ CANDIDATE_PROFILE_COMPLETED
145
+
146
+ EVALUATION_PLAN_CREATED
147
+ EVALUATION_PLAN_PUBLISHED
148
+ EVALUATION_PLAN_DELETED
149
+ EVALUATION_PLAN_UPDATED
150
+ STATUS_CHANGED
151
+
152
+ CUSTOM
153
+
154
+ @@schema("public")
155
+ }
156
+
157
+ enum ActivityEntityType {
158
+ APPLICATION
159
+
160
+ CANDIDATE
161
+
162
+ JOB
163
+
164
+ ONGOING_EVALUATION
165
+
166
+ EVALUATION_PLAN
167
+
168
+ INTERVIEW
169
+
170
+ ASSIGNMENT
171
+
172
+ ASSESSMENT
173
+
174
+ ORGANISATION
175
+
176
+ USER
177
+
178
+ @@schema("public")
179
+ }
180
+
181
+ enum ActivityEntityActorType {
182
+ USER
183
+
184
+ SYSTEM
185
+
186
+ AI_AGENT
187
+
188
+ WEBHOOK
189
+
190
+ @@schema("public")
191
+ }
192
+
193
+ model ActivityEvent {
194
+ id String @id @default(uuid())
195
+
196
+ organisation_id String?
197
+
198
+ event_type ActivityEventType
199
+
200
+ entity_type ActivityEntityType
201
+ entity_id String
202
+
203
+ actor_id String?
204
+ actor_type ActivityEntityActorType
205
+
206
+ related_entities Json?
207
+
208
+ snapshot Json?
209
+
210
+ payload Json?
211
+
212
+ schema_version Int @default(1)
213
+
214
+ occurred_at DateTime
215
+
216
+ created_at DateTime @default(now())
217
+
218
+ organisation Organisation? @relation(fields: [organisation_id], references: [id])
219
+
220
+ @@index([organisation_id, occurred_at])
221
+ @@index([organisation_id, event_type])
222
+ @@index([entity_type, entity_id])
223
+ @@index([actor_id])
224
+ @@index([occurred_at])
225
+ @@map("activity_events")
226
+ @@schema("public")
81
227
  }
82
228
 
83
229
  enum ActivityActorType {
84
230
  USER
85
231
  AI
86
232
  SYSTEM
233
+
234
+ @@schema("public")
87
235
  }
88
236
 
89
237
  model ActivityLog {
@@ -101,15 +249,107 @@ model ActivityLog {
101
249
  application Application @relation(fields: [application_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
102
250
 
103
251
  @@index([application_id])
252
+ @@schema("public")
253
+ }
254
+
255
+ model ApplicationAnalytics {
256
+ id String @id @default(uuid())
257
+
258
+ organisation_id String
259
+ application_id String @unique
260
+ job_description_id String
261
+ candidate_id String
262
+
263
+ source_id String?
264
+ source_name String?
265
+ source_category SourceCategory?
266
+ source_colour String?
267
+
268
+ job_code String?
269
+ job_number Int?
270
+ role_title String?
271
+ hiring_manager_id String?
272
+
273
+ candidate_name String?
274
+ recruiter_id String?
275
+
276
+ applied_at DateTime
277
+ status_updated_at DateTime?
278
+
279
+ status ApplicationStatus?
280
+ fit_check_score Float?
281
+
282
+ is_screened Boolean @default(false)
283
+ is_evaluated Boolean @default(false)
284
+ is_rejected Boolean @default(false)
285
+ is_shortlisted Boolean @default(false)
286
+ has_committed_evaluation Boolean @default(false)
287
+
288
+ updated_at DateTime @updatedAt
289
+
290
+ @@index([organisation_id, applied_at])
291
+ @@index([organisation_id, source_id, applied_at])
292
+ @@index([job_description_id, applied_at])
293
+ @@index([organisation_id, hiring_manager_id])
294
+ @@map("application_analytics")
295
+ @@schema("analytics")
296
+ }
297
+
298
+ model ApplicationAnalyticsDaily {
299
+ id String @id @default(uuid())
300
+
301
+ snapshot_date DateTime @db.Date
302
+
303
+ organisation_id String
304
+ application_id String
305
+ job_description_id String
306
+ candidate_id String
307
+
308
+ source_id String?
309
+ source_name String?
310
+ source_category SourceCategory?
311
+ source_colour String?
312
+
313
+ job_code String?
314
+ job_number Int?
315
+ role_title String?
316
+ hiring_manager_id String?
317
+
318
+ candidate_name String?
319
+ recruiter_id String?
320
+
321
+ applied_at DateTime
322
+ status_updated_at DateTime?
323
+
324
+ status ApplicationStatus?
325
+ fit_check_score Float?
326
+
327
+ is_screened Boolean @default(false)
328
+ is_evaluated Boolean @default(false)
329
+ is_rejected Boolean @default(false)
330
+ is_shortlisted Boolean @default(false)
331
+ has_committed_evaluation Boolean @default(false)
332
+
333
+ @@unique([snapshot_date, application_id])
334
+ @@index([snapshot_date], map: "aad_snapshot_date_idx")
335
+ @@index([snapshot_date, organisation_id], map: "aad_snapshot_org_idx")
336
+ @@index([snapshot_date, organisation_id, source_id], map: "aad_snapshot_org_source_idx")
337
+ @@index([snapshot_date, organisation_id, applied_at], map: "aad_snapshot_org_applied_idx")
338
+ @@index([snapshot_date, job_description_id], map: "aad_snapshot_job_idx")
339
+ @@map("application_analytics_daily")
340
+ @@schema("analytics")
104
341
  }
105
342
 
106
343
  // PENDING could be understood as unscreened
107
344
  enum ApplicationStatus {
108
345
  PENDING
109
346
  IN_PROGRESS
110
- SHORTLISTED
111
347
  SELECTED
348
+ SHORTLISTED
112
349
  REJECTED
350
+ ON_HOLD
351
+
352
+ @@schema("public")
113
353
  }
114
354
 
115
355
  model Application {
@@ -122,8 +362,11 @@ model Application {
122
362
  applied_at DateTime @default(now())
123
363
  evaluation_plan_id String?
124
364
  fit_check_id String? @unique
365
+ recruiter_id String?
366
+ source_id String?
125
367
  round_no Int @default(0)
126
368
  is_jaf_completed Boolean @default(false)
369
+ proceed_to_next_round Boolean? @default(false)
127
370
  //Screening fields
128
371
  on_notice_period Boolean @default(false)
129
372
  expected_joining_date DateTime?
@@ -141,14 +384,16 @@ model Application {
141
384
  resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
142
385
  job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
143
386
  fit_check FitCheck? @relation(fields: [fit_check_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
387
+ recruiter User? @relation("ApplicationRecruiter", fields: [recruiter_id], references: [id])
388
+ source Source? @relation(fields: [source_id], references: [id], onDelete: SetNull)
144
389
  interviews Interview[]
145
390
  assignments Assignment[]
146
391
  ongoing_evaluations OngoingEvaluation[]
147
392
  activity_logs ActivityLog[]
148
393
  notes Notes[]
149
- job_application_responses JobApplicationResponse[]
150
394
  conversations Conversation[]
151
395
  communication_messages CommunicationMessage[]
396
+ job_application_responses JobApplicationResponse[]
152
397
  // Audit fields
153
398
  created_at DateTime @default(now())
154
399
  updated_at DateTime @updatedAt
@@ -159,6 +404,8 @@ model Application {
159
404
  @@unique([candidate_id, job_description_id]) // Ensures candidate applies only once per job
160
405
  @@index([candidate_id])
161
406
  @@index([job_description_id])
407
+ @@index([source_id])
408
+ @@schema("public")
162
409
  }
163
410
 
164
411
  model Approval {
@@ -174,6 +421,8 @@ model Approval {
174
421
  job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
175
422
  user User @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
176
423
  organisation Organisation @relation(fields: [organisaton_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
424
+
425
+ @@schema("public")
177
426
  }
178
427
 
179
428
  model Assessment {
@@ -214,6 +463,7 @@ model Assessment {
214
463
  @@unique([assessment_library_id, candidate_id])
215
464
  @@index([assessment_library_id])
216
465
  @@index([candidate_id])
466
+ @@schema("public")
217
467
  }
218
468
 
219
469
  /// Defines how an assessment is conducted.
@@ -236,6 +486,7 @@ model AssessmentLibrary {
236
486
  evaluation_Plans EvaluationPlan[]
237
487
 
238
488
  @@index([organisation_id])
489
+ @@schema("public")
239
490
  }
240
491
 
241
492
  /**
@@ -254,12 +505,135 @@ model AssessmentQuestion {
254
505
  updated_at DateTime @updatedAt
255
506
 
256
507
  @@id([assessment_id, question_id])
508
+ @@schema("public")
509
+ }
510
+
511
+ enum AssessmentRoundStatus {
512
+ SCHEDULED
513
+ IN_PROGRESS
514
+ COMPLETED
515
+ EVALUATED
516
+ CANCELLED
517
+
518
+ @@schema("analytics")
519
+ }
520
+
521
+ model AssessmentRoundAnalytics {
522
+ id String @id @default(uuid())
523
+
524
+ organisation_id String
525
+ round_id String @unique
526
+ assessment_id String @unique
527
+ application_id String?
528
+ candidate_id String
529
+ job_description_id String
530
+ evaluation_plan_id String
531
+
532
+ job_code String?
533
+ job_number Int?
534
+ role_title String?
535
+ hiring_manager_id String?
536
+ department String?
537
+ location String?
538
+
539
+ round_name String?
540
+ evaluation_category EvaluationCategory?
541
+ round_type RoundType?
542
+ round_format EvaluationRoundFormat?
543
+ plan_order_no Int?
544
+ plan_type EvaluationPlanType?
545
+ is_custom Boolean @default(false)
546
+
547
+ reviewer_id String?
548
+ reviewer_employee_id String?
549
+ reviewer_name String?
550
+
551
+ candidate_name String?
552
+
553
+ evaluation_type EvaluationType?
554
+
555
+ scheduled_start_at DateTime?
556
+ scheduled_end_at DateTime?
557
+ actual_start_at DateTime?
558
+ actual_end_at DateTime?
559
+ attempt_expires_at DateTime?
560
+ evaluated_at DateTime?
561
+
562
+ score Float?
563
+ status AssessmentRoundStatus?
564
+ round_result RoundResult?
565
+
566
+ updated_at DateTime @updatedAt
567
+
568
+ @@index([organisation_id, evaluated_at])
569
+ @@index([organisation_id, reviewer_id])
570
+ @@index([job_description_id])
571
+ @@index([application_id])
572
+ @@map("assessment_round_analytics")
573
+ @@schema("analytics")
574
+ }
575
+
576
+ model AssessmentRoundAnalyticsDaily {
577
+ id String @id @default(uuid())
578
+
579
+ snapshot_date DateTime @db.Date
580
+
581
+ organisation_id String
582
+ round_id String
583
+ assessment_id String
584
+ application_id String?
585
+ candidate_id String
586
+ job_description_id String
587
+ evaluation_plan_id String
588
+
589
+ job_code String?
590
+ job_number Int?
591
+ role_title String?
592
+ hiring_manager_id String?
593
+ department String?
594
+ location String?
595
+
596
+ round_name String?
597
+ evaluation_category EvaluationCategory?
598
+ round_type RoundType?
599
+ round_format EvaluationRoundFormat?
600
+ plan_order_no Int?
601
+ plan_type EvaluationPlanType?
602
+ is_custom Boolean @default(false)
603
+
604
+ reviewer_id String?
605
+ reviewer_employee_id String?
606
+ reviewer_name String?
607
+
608
+ candidate_name String?
609
+
610
+ evaluation_type EvaluationType?
611
+
612
+ scheduled_start_at DateTime?
613
+ scheduled_end_at DateTime?
614
+ actual_start_at DateTime?
615
+ actual_end_at DateTime?
616
+ attempt_expires_at DateTime?
617
+ evaluated_at DateTime?
618
+
619
+ score Float?
620
+ status AssessmentRoundStatus?
621
+ round_result RoundResult?
622
+
623
+ @@unique([snapshot_date, assessment_id])
624
+ @@index([snapshot_date], map: "asrad_snapshot_date_idx")
625
+ @@index([snapshot_date, organisation_id], map: "asrad_snapshot_org_idx")
626
+ @@index([snapshot_date, job_description_id], map: "asrad_snapshot_job_idx")
627
+ @@map("assessment_round_analytics_daily")
628
+ @@schema("analytics")
257
629
  }
258
630
 
259
631
  enum AssignmentStatus {
260
632
  AVAILABLE
261
633
  SCHEDULED
262
634
  CANCELLED
635
+
636
+ @@schema("public")
263
637
  }
264
638
 
265
639
  model Assignment {
@@ -303,6 +677,7 @@ model Assignment {
303
677
  @@index([candidate_id])
304
678
  @@index([reviewer_id])
305
679
  @@index([job_description_id])
680
+ @@schema("public")
306
681
  }
307
682
 
308
683
  model AssignmentLibrary {
@@ -324,6 +699,117 @@ model AssignmentLibrary {
324
699
  assignments Assignment[]
325
700
 
326
701
  @@index([job_description_id])
702
+ @@schema("public")
703
+ }
704
+
705
+ model AssignmentRoundAnalytics {
706
+ id String @id @default(uuid())
707
+
708
+ organisation_id String
709
+ round_id String @unique
710
+ assignment_id String @unique
711
+ application_id String?
712
+ candidate_id String
713
+ job_description_id String
714
+ evaluation_plan_id String
715
+
716
+ job_code String?
717
+ job_number Int?
718
+ role_title String?
719
+ hiring_manager_id String?
720
+ department String?
721
+ location String?
722
+
723
+ round_name String?
724
+ evaluation_category EvaluationCategory?
725
+ round_type RoundType?
726
+ round_format EvaluationRoundFormat?
727
+ plan_order_no Int?
728
+ plan_type EvaluationPlanType?
729
+ is_custom Boolean @default(false)
730
+
731
+ reviewer_id String?
732
+ reviewer_employee_id String?
733
+ reviewer_name String?
734
+
735
+ candidate_name String?
736
+
737
+ evaluation_type EvaluationType?
738
+
739
+ scheduled_start_at DateTime?
740
+ scheduled_end_at DateTime?
741
+ completed_at DateTime?
742
+ evaluated_at DateTime?
743
+ cancelled_at DateTime?
744
+
745
+ status AssignmentStatus?
746
+ overall_score Int?
747
+ cancel_reason String?
748
+ round_result RoundResult?
749
+
750
+ updated_at DateTime @updatedAt
751
+
752
+ @@index([organisation_id, evaluated_at])
753
+ @@index([organisation_id, reviewer_id])
754
+ @@index([job_description_id])
755
+ @@index([application_id])
756
+ @@map("assignment_round_analytics")
757
+ @@schema("analytics")
758
+ }
759
+
760
+ model AssignmentRoundAnalyticsDaily {
761
+ id String @id @default(uuid())
762
+
763
+ snapshot_date DateTime @db.Date
764
+
765
+ organisation_id String
766
+ round_id String
767
+ assignment_id String
768
+ application_id String?
769
+ candidate_id String
770
+ job_description_id String
771
+ evaluation_plan_id String
772
+
773
+ job_code String?
774
+ job_number Int?
775
+ role_title String?
776
+ hiring_manager_id String?
777
+ department String?
778
+ location String?
779
+
780
+ round_name String?
781
+ evaluation_category EvaluationCategory?
782
+ round_type RoundType?
783
+ round_format EvaluationRoundFormat?
784
+ plan_order_no Int?
785
+ plan_type EvaluationPlanType?
786
+ is_custom Boolean @default(false)
787
+
788
+ reviewer_id String?
789
+ reviewer_employee_id String?
790
+ reviewer_name String?
791
+
792
+ candidate_name String?
793
+
794
+ evaluation_type EvaluationType?
795
+
796
+ scheduled_start_at DateTime?
797
+ scheduled_end_at DateTime?
798
+ completed_at DateTime?
799
+ evaluated_at DateTime?
800
+ cancelled_at DateTime?
801
+
802
+ status AssignmentStatus?
803
+ overall_score Int?
804
+ cancel_reason String?
805
+ round_result RoundResult?
806
+
807
+ @@unique([snapshot_date, assignment_id])
808
+ @@index([snapshot_date], map: "arad_snapshot_date_idx")
809
+ @@index([snapshot_date, organisation_id], map: "arad_snapshot_org_idx")
810
+ @@index([snapshot_date, job_description_id], map: "arad_snapshot_job_idx")
811
+ @@map("assignment_round_analytics_daily")
812
+ @@schema("analytics")
327
813
  }
328
814
 
329
815
  enum AuthProvider {
@@ -331,6 +817,8 @@ enum AuthProvider {
331
817
  MICROSOFT
332
818
  ZOOM
333
819
  CALENDLY
820
+
821
+ @@schema("public")
334
822
  }
335
823
 
336
824
  model AuthModule {
@@ -361,6 +849,7 @@ model AuthModule {
361
849
  @@unique([user_id, provider])
362
850
  @@unique([provider, provider_account_id])
363
851
  @@index([user_id])
852
+ @@schema("public")
364
853
  }
365
854
 
366
855
  enum JobType {
@@ -369,6 +858,8 @@ enum JobType {
369
858
  Contract
370
859
  Internship
371
860
  Temporary
861
+
862
+ @@schema("public")
372
863
  }
373
864
 
374
865
  enum JDCreationType {
@@ -376,6 +867,8 @@ enum JDCreationType {
376
867
  Upload_JD
377
868
  Create_New
378
869
  Create_From_Profile
870
+
871
+ @@schema("public")
379
872
  }
380
873
 
381
874
  model Budget {
@@ -400,6 +893,8 @@ model Budget {
400
893
  created_by String
401
894
  updated_by String
402
895
  is_active Boolean @default(true)
896
+
897
+ @@schema("public")
403
898
  }
404
899
 
405
900
  model Calendly {
@@ -419,6 +914,8 @@ model Calendly {
419
914
  created_by String
420
915
  updated_by String
421
916
  is_active Boolean @default(true)
917
+
918
+ @@schema("public")
422
919
  }
423
920
 
424
921
  model CandidateProfile {
@@ -446,6 +943,8 @@ model CandidateProfile {
446
943
  veteran_status String?
447
944
  disability_status String?
448
945
  is_active Boolean @default(true)
946
+
947
+ @@schema("public")
449
948
  }
450
949
 
451
950
  // Multi-channel communication (WhatsApp, Email, SMS, Call) with provider abstraction.
@@ -456,6 +955,8 @@ enum CommChannel {
456
955
  EMAIL
457
956
  SMS
458
957
  CALL
958
+
959
+ @@schema("public")
459
960
  }
460
961
 
461
962
  enum CommProvider {
@@ -468,11 +969,15 @@ enum CommProvider {
468
969
  OUTLOOK
469
970
  GENERIC_SMTP
470
971
  GENERIC
972
+
973
+ @@schema("public")
471
974
  }
472
975
 
473
976
  enum CommDirection {
474
977
  INBOUND
475
978
  OUTBOUND
979
+
980
+ @@schema("public")
476
981
  }
477
982
 
478
983
  enum CommMessageStatus {
@@ -482,6 +987,8 @@ enum CommMessageStatus {
482
987
  READ
483
988
  FAILED
484
989
  RECEIVED
990
+
991
+ @@schema("public")
485
992
  }
486
993
 
487
994
  /// Per-organisation provider selection + (encrypted) credentials for one channel.
@@ -510,6 +1017,7 @@ model ChannelProviderConfig {
510
1017
  @@unique([organisation_id, channel, provider])
511
1018
  @@index([organisation_id, channel])
512
1019
  @@index([organisation_id, channel, is_active])
1020
+ @@schema("public")
513
1021
  }
514
1022
 
515
1023
  /// A logical conversation thread with one external party on one channel.
@@ -554,6 +1062,7 @@ model Conversation {
554
1062
  @@index([external_id])
555
1063
  @@index([organisation_id, application_id])
556
1064
  @@index([organisation_id, job_description_id])
1065
+ @@schema("public")
557
1066
  }
558
1067
 
559
1068
  /// Individual message in a conversation. Inbound + outbound share the same model.
@@ -603,6 +1112,7 @@ model CommunicationMessage {
603
1112
  @@index([organisation_id, status])
604
1113
  @@index([organisation_id, application_id])
605
1114
  @@index([organisation_id, job_description_id])
1115
+ @@schema("public")
606
1116
  }
607
1117
 
608
1118
  model ContactUs {
@@ -616,6 +1126,8 @@ model ContactUs {
616
1126
  createdAt DateTime @default(now())
617
1127
  updatedAt DateTime @updatedAt
618
1128
  is_active Boolean @default(true)
1129
+
1130
+ @@schema("public")
619
1131
  }
620
1132
 
621
1133
  model Document {
@@ -643,8 +1155,8 @@ model Document {
643
1155
  // Relations
644
1156
  organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
645
1157
  candidate User? @relation(fields: [candidate_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
646
- resume Resume?
647
- resume_rendered_export Resume? @relation("RenderedResumeExportDocument")
1158
+ resume Resume? @relation("ResumeSourceDocument")
1159
+ resume_rendered_export Resume? @relation("RenderedResumeExport")
648
1160
  job_description_source JobDescription? @relation("SourceDocument")
649
1161
  job_description_rendered JobDescription? @relation("RenderedJdDocument")
650
1162
  interview_recording Interview?
@@ -656,6 +1168,7 @@ model Document {
656
1168
  @@index([candidate_id])
657
1169
  @@index([organisation_id, candidate_id])
658
1170
  @@index([file_hash])
1171
+ @@schema("public")
659
1172
  }
660
1173
 
661
1174
  enum RoundType {
@@ -663,6 +1176,18 @@ enum RoundType {
663
1176
  INTERVIEW
664
1177
  ASSIGNMENT
665
1178
  SCREENING
1179
+
1180
+ @@schema("public")
1181
+ }
1182
+
1183
+ enum EvaluationCategory {
1184
+ EXPERIENCE_SCREENING
1185
+ TECHNICAL_SCREENING
1186
+ TECHNICAL_INTERVIEW
1187
+ BUSINESS_ROUND
1188
+ BEHAVIORAL_ROUND
1189
+
1190
+ @@schema("public")
666
1191
  }
667
1192
 
668
1193
  enum EvaluationRoundFormat {
@@ -692,6 +1217,8 @@ enum EvaluationRoundFormat {
692
1217
  TREADSPACE_AI_ASSISTED
693
1218
  EXTERNAL_VIDEO_AI_ASSISTED
694
1219
  EXTERNAL_VIDEO_UNASSISTED
1220
+
1221
+ @@schema("public")
695
1222
  }
696
1223
 
697
1224
  enum EvaluationType {
@@ -700,24 +1227,32 @@ enum EvaluationType {
700
1227
  TREADSPACE_FULL_AI
701
1228
  EXTERNAL_AI_ASSISTED
702
1229
  NON_AI_ASSISTED
1230
+
1231
+ @@schema("public")
703
1232
  }
704
1233
 
705
1234
  enum EvaluationPlanType {
706
1235
  CUSTOM
707
1236
  GENERIC
708
1237
  DELETED
1238
+
1239
+ @@schema("public")
709
1240
  }
710
1241
 
711
1242
  enum EvaluationPlanShareScope {
712
1243
  PRIVATE
713
1244
  CREATOR
714
1245
  ORGANIZATION
1246
+
1247
+ @@schema("public")
715
1248
  }
716
1249
 
717
1250
  enum DurationUnit {
718
1251
  MINUTES
719
1252
  HOURS
720
1253
  DAYS
1254
+
1255
+ @@schema("public")
721
1256
  }
722
1257
 
723
1258
  model EvaluationPlan {
@@ -733,6 +1268,7 @@ model EvaluationPlan {
733
1268
  elimination_round Boolean @default(false)
734
1269
  evaluation_type EvaluationType @default(TREADSPACE_AI_ASSISTED)
735
1270
  type_of_round RoundType
1271
+ round_purpose String?
736
1272
  timeline Int?
737
1273
  order_no Int?
738
1274
  details Json?
@@ -741,6 +1277,7 @@ model EvaluationPlan {
741
1277
  duration Int?
742
1278
  duration_unit DurationUnit?
743
1279
  deadline Int?
1280
+ category EvaluationCategory?
744
1281
  created_by String
745
1282
  updated_by String
746
1283
  created_at DateTime @default(now())
@@ -759,6 +1296,7 @@ model EvaluationPlan {
759
1296
  @@index([job_description_id])
760
1297
  @@index([job_description_id, plan_type, share_scope])
761
1298
  @@index([created_by, share_scope])
1299
+ @@schema("public")
762
1300
  }
763
1301
 
764
1302
  model Feedback {
@@ -778,12 +1316,15 @@ model Feedback {
778
1316
 
779
1317
  @@unique([interview_id, order_no])
780
1318
  @@index([interview_id])
1319
+ @@schema("public")
781
1320
  }
782
1321
 
783
1322
  enum FitCheckStatus {
784
1323
  RECOMMENDED
785
1324
  TO_REVIEW
786
1325
  NOT_RECOMMENDED
1326
+
1327
+ @@schema("public")
787
1328
  }
788
1329
 
789
1330
  model FitCheck {
@@ -837,6 +1378,7 @@ model FitCheck {
837
1378
  /// Ensure one FitCheck per (resume_id, job_description_id) pair
838
1379
  @@unique([resume_id, job_description_id])
839
1380
  @@index([resume_id])
1381
+ @@schema("public")
840
1382
  }
841
1383
 
842
1384
  model Google {
@@ -854,6 +1396,8 @@ model Google {
854
1396
  created_by String
855
1397
  updated_by String
856
1398
  is_active Boolean @default(true)
1399
+
1400
+ @@schema("public")
857
1401
  }
858
1402
 
859
1403
  enum IntegrationProvider {
@@ -864,18 +1408,24 @@ enum IntegrationProvider {
864
1408
  MICROSOFT
865
1409
  ZOOM
866
1410
  CALENDLY
1411
+
1412
+ @@schema("public")
867
1413
  }
868
1414
 
869
1415
  enum IntegrationAuthType {
870
1416
  OAUTH2
871
1417
  API_KEY
872
1418
  SSO
1419
+
1420
+ @@schema("public")
873
1421
  }
874
1422
 
875
1423
  enum SyncDirection {
876
1424
  PUSH
877
1425
  PULL
878
1426
  BIDIRECTIONAL
1427
+
1428
+ @@schema("public")
879
1429
  }
880
1430
 
881
1431
  enum SyncEntityType {
@@ -883,12 +1433,16 @@ enum SyncEntityType {
883
1433
  JOB_OPENING
884
1434
  INTERVIEW
885
1435
  APPLICATION
1436
+
1437
+ @@schema("public")
886
1438
  }
887
1439
 
888
1440
  enum SyncStatus {
889
1441
  SYNCED
890
1442
  PENDING
891
1443
  FAILED
1444
+
1445
+ @@schema("public")
892
1446
  }
893
1447
 
894
1448
  model IntegrationCredential {
@@ -913,6 +1467,7 @@ model IntegrationCredential {
913
1467
 
914
1468
  @@unique([organisation_id, provider])
915
1469
  @@index([provider])
1470
+ @@schema("public")
916
1471
  }
917
1472
 
918
1473
  model IntegrationJobSync {
@@ -932,6 +1487,7 @@ model IntegrationJobSync {
932
1487
 
933
1488
  @@unique([job_description_id, provider])
934
1489
  @@index([provider])
1490
+ @@schema("public")
935
1491
  }
936
1492
 
937
1493
  model ZohoSyncMapping {
@@ -953,6 +1509,7 @@ model ZohoSyncMapping {
953
1509
  @@unique([organisation_id, entity_type, treadspace_id])
954
1510
  @@index([zoho_record_id])
955
1511
  @@index([sync_status])
1512
+ @@schema("public")
956
1513
  }
957
1514
 
958
1515
  enum InterviewStatus {
@@ -963,6 +1520,8 @@ enum InterviewStatus {
963
1520
  NO_SHOW // Candidate or interviewer failed to appear
964
1521
  EVALUATION_PENDING // Waiting for feedback or evaluation
965
1522
  EVALUATED // Feedback completed and locked
1523
+
1524
+ @@schema("public")
966
1525
  }
967
1526
 
968
1527
  enum InterviewFeedback {
@@ -970,16 +1529,22 @@ enum InterviewFeedback {
970
1529
  HIRE
971
1530
  NO_HIRE
972
1531
  STRONG_NO_HIRE
1532
+
1533
+ @@schema("public")
973
1534
  }
974
1535
 
975
1536
  enum InterviewPlatform {
976
1537
  TREADSPACE
977
1538
  ZOOM
1539
+
1540
+ @@schema("public")
978
1541
  }
979
1542
 
980
1543
  enum AiAssistanceMode {
981
1544
  NONE
982
1545
  ASSISTED
1546
+
1547
+ @@schema("public")
983
1548
  }
984
1549
 
985
1550
  model Interview {
@@ -1066,6 +1631,7 @@ model Interview {
1066
1631
  @@index([candidate_id])
1067
1632
  @@index([interviewer_id])
1068
1633
  @@index([job_description_id])
1634
+ @@schema("public")
1069
1635
  }
1070
1636
 
1071
1637
  model InterviewNotes {
@@ -1084,47 +1650,322 @@ model InterviewNotes {
1084
1650
  interview Interview @relation(fields: [interview_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1085
1651
 
1086
1652
  @@index([interview_id])
1653
+ @@schema("public")
1087
1654
  }
1088
1655
 
1089
- enum JobApplicationFieldType {
1090
- TEXT
1091
- NUMBER
1092
- DATE
1093
- BOOLEAN
1094
- MULTI_SELECT
1095
- FILE
1096
- DROP_DOWN
1656
+ enum InterviewRecommendation {
1657
+ ACCEPTED
1658
+ REJECTED
1659
+ UNSURE
1660
+
1661
+ @@schema("analytics")
1097
1662
  }
1098
1663
 
1099
- model JobApplicationField {
1100
- /// Primary key (UUID)
1101
- id String @id @default(uuid())
1102
- /// Foreign keys
1103
- organisation_id String
1104
- template_id String
1105
- /// Data fields
1106
- field_type JobApplicationFieldType
1107
- label String
1108
- description String?
1109
- is_mandatory Boolean @default(false)
1110
- is_draft Boolean @default(true)
1111
- options String[]
1112
- /// Audit fields
1113
- is_active Boolean @default(true)
1114
- created_by String
1115
- updated_by String
1116
- created_at DateTime @default(now())
1117
- updated_at DateTime @updatedAt
1118
- /// Relations
1119
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1120
- job_application_template JobApplicationTemplate @relation(fields: [template_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1121
- job_application_responses JobApplicationResponse[]
1664
+ model InterviewRoundAnalytics {
1665
+ id String @id @default(uuid())
1122
1666
 
1123
- /// Indexes
1124
- @@index([organisation_id, template_id])
1667
+ organisation_id String
1668
+ round_id String @unique
1669
+ interview_id String @unique
1670
+ application_id String?
1671
+ candidate_id String
1672
+ job_description_id String
1673
+ evaluation_plan_id String
1674
+
1675
+ job_code String?
1676
+ job_number Int?
1677
+ role_title String?
1678
+ hiring_manager_id String?
1679
+ department String?
1680
+ location String?
1681
+
1682
+ round_name String?
1683
+ evaluation_category EvaluationCategory?
1684
+ round_type RoundType?
1685
+ round_format EvaluationRoundFormat?
1686
+ plan_order_no Int?
1687
+ plan_type EvaluationPlanType?
1688
+ is_custom Boolean @default(false)
1689
+
1690
+ interviewer_id String?
1691
+ interviewer_employee_id String?
1692
+ interviewer_name String?
1693
+
1694
+ candidate_name String?
1695
+ candidate_email String?
1696
+
1697
+ evaluation_type EvaluationType?
1698
+ ai_assistance_mode AiAssistanceMode?
1699
+ interview_platform InterviewPlatform?
1700
+ interview_status InterviewStatus?
1701
+
1702
+ scheduled_start_at DateTime?
1703
+ scheduled_end_at DateTime?
1704
+ actual_start_at DateTime?
1705
+ actual_end_at DateTime?
1706
+ evaluated_at DateTime?
1707
+ first_assigned_at DateTime?
1708
+ duration_minutes Int?
1709
+
1710
+ human_rating String?
1711
+ ai_rating String?
1712
+ recommendation InterviewRecommendation?
1713
+ ai_disagrees_with_ai Boolean?
1714
+
1715
+ difficulty_score Float?
1716
+ supportiveness_score Float?
1717
+ topics_coverage_percent Float?
1718
+
1719
+ updated_at DateTime @updatedAt
1720
+
1721
+ @@index([organisation_id, evaluated_at])
1722
+ @@index([organisation_id, interviewer_id, evaluated_at])
1723
+ @@index([job_description_id])
1724
+ @@index([application_id])
1725
+ @@index([organisation_id, hiring_manager_id])
1726
+ @@map("interview_round_analytics")
1727
+ @@schema("analytics")
1125
1728
  }
1126
1729
 
1127
- model JobApplicationResponse {
1730
+ model InterviewRoundAnalyticsDaily {
1731
+ id String @id @default(uuid())
1732
+
1733
+ snapshot_date DateTime @db.Date
1734
+
1735
+ organisation_id String
1736
+ round_id String
1737
+ interview_id String
1738
+ application_id String?
1739
+ candidate_id String
1740
+ job_description_id String
1741
+ evaluation_plan_id String
1742
+
1743
+ job_code String?
1744
+ job_number Int?
1745
+ role_title String?
1746
+ hiring_manager_id String?
1747
+ department String?
1748
+ location String?
1749
+
1750
+ round_name String?
1751
+ evaluation_category EvaluationCategory?
1752
+ round_type RoundType?
1753
+ round_format EvaluationRoundFormat?
1754
+ plan_order_no Int?
1755
+ plan_type EvaluationPlanType?
1756
+ is_custom Boolean @default(false)
1757
+
1758
+ interviewer_id String?
1759
+ interviewer_employee_id String?
1760
+ interviewer_name String?
1761
+
1762
+ candidate_name String?
1763
+ candidate_email String?
1764
+
1765
+ evaluation_type EvaluationType?
1766
+ ai_assistance_mode AiAssistanceMode?
1767
+ interview_platform InterviewPlatform?
1768
+ interview_status InterviewStatus?
1769
+
1770
+ scheduled_start_at DateTime?
1771
+ scheduled_end_at DateTime?
1772
+ actual_start_at DateTime?
1773
+ actual_end_at DateTime?
1774
+ evaluated_at DateTime?
1775
+ first_assigned_at DateTime?
1776
+ duration_minutes Int?
1777
+
1778
+ human_rating String?
1779
+ ai_rating String?
1780
+ recommendation InterviewRecommendation?
1781
+ ai_disagrees_with_ai Boolean?
1782
+
1783
+ difficulty_score Float?
1784
+ supportiveness_score Float?
1785
+ topics_coverage_percent Float?
1786
+
1787
+ @@unique([snapshot_date, interview_id])
1788
+ @@index([snapshot_date], map: "irad_snapshot_date_idx")
1789
+ @@index([snapshot_date, organisation_id], map: "irad_snapshot_org_idx")
1790
+ @@index([snapshot_date, organisation_id, interviewer_id], map: "irad_snapshot_org_interviewer_idx")
1791
+ @@index([snapshot_date, job_description_id], map: "irad_snapshot_job_idx")
1792
+ @@index([snapshot_date, organisation_id, evaluated_at], map: "irad_snapshot_org_evaluated_idx")
1793
+ @@map("interview_round_analytics_daily")
1794
+ @@schema("analytics")
1795
+ }
1796
+
1797
+ model InterviewerOrganisationAnalytics {
1798
+ id String @id @default(uuid())
1799
+ organisation_id String
1800
+ user_id String
1801
+
1802
+ name String?
1803
+ employee_id String?
1804
+
1805
+ interview_count Int @default(0)
1806
+ accepted_count Int @default(0)
1807
+ rejected_count Int @default(0)
1808
+ unsure_count Int @default(0)
1809
+ ai_disagreement_count Int @default(0)
1810
+ ai_disagreement_percent Float?
1811
+ avg_difficulty Float?
1812
+ avg_supportiveness Float?
1813
+ avg_topics_coverage_percent Float?
1814
+
1815
+ updated_at DateTime @updatedAt
1816
+
1817
+ @@unique([organisation_id, user_id])
1818
+ @@index([organisation_id])
1819
+ @@index([organisation_id, user_id])
1820
+ @@map("interviewer_organisation_analytics")
1821
+ @@schema("analytics")
1822
+ }
1823
+
1824
+ model InterviewerJobAnalytics {
1825
+ id String @id @default(uuid())
1826
+ organisation_id String
1827
+ user_id String
1828
+ job_description_id String
1829
+
1830
+ hiring_manager_id String?
1831
+ department String?
1832
+ location String?
1833
+ role_title String?
1834
+ job_code String?
1835
+ opened_at DateTime?
1836
+
1837
+ name String?
1838
+ employee_id String?
1839
+
1840
+ interview_count Int @default(0)
1841
+ accepted_count Int @default(0)
1842
+ rejected_count Int @default(0)
1843
+ unsure_count Int @default(0)
1844
+ ai_disagreement_count Int @default(0)
1845
+ ai_disagreement_percent Float?
1846
+ avg_difficulty Float?
1847
+ avg_supportiveness Float?
1848
+ avg_topics_coverage_percent Float?
1849
+
1850
+ updated_at DateTime @updatedAt
1851
+
1852
+ @@unique([organisation_id, user_id, job_description_id])
1853
+ @@index([organisation_id, job_description_id])
1854
+ @@index([organisation_id, hiring_manager_id])
1855
+ @@index([organisation_id, department])
1856
+ @@index([organisation_id, location])
1857
+ @@index([organisation_id, user_id])
1858
+ @@map("interviewer_job_analytics")
1859
+ @@schema("analytics")
1860
+ }
1861
+
1862
+ model InterviewerOrganisationAnalyticsDaily {
1863
+ id String @id @default(uuid())
1864
+ snapshot_date DateTime @db.Date
1865
+ organisation_id String
1866
+ user_id String
1867
+
1868
+ name String?
1869
+ employee_id String?
1870
+
1871
+ interview_count Int @default(0)
1872
+ accepted_count Int @default(0)
1873
+ rejected_count Int @default(0)
1874
+ unsure_count Int @default(0)
1875
+ ai_disagreement_count Int @default(0)
1876
+ ai_disagreement_percent Float?
1877
+ avg_difficulty Float?
1878
+ avg_supportiveness Float?
1879
+ avg_topics_coverage_percent Float?
1880
+
1881
+ @@unique([snapshot_date, organisation_id, user_id])
1882
+ @@index([snapshot_date], map: "ioad_snapshot_date_idx")
1883
+ @@index([snapshot_date, organisation_id], map: "ioad_snapshot_org_idx")
1884
+ @@index([snapshot_date, organisation_id, user_id], map: "ioad_snapshot_org_user_idx")
1885
+ @@map("interviewer_organisation_analytics_daily")
1886
+ @@schema("analytics")
1887
+ }
1888
+
1889
+ model InterviewerJobAnalyticsDaily {
1890
+ id String @id @default(uuid())
1891
+ snapshot_date DateTime @db.Date
1892
+ organisation_id String
1893
+ user_id String
1894
+ job_description_id String
1895
+
1896
+ hiring_manager_id String?
1897
+ department String?
1898
+ location String?
1899
+ role_title String?
1900
+ job_code String?
1901
+ opened_at DateTime?
1902
+
1903
+ name String?
1904
+ employee_id String?
1905
+
1906
+ interview_count Int @default(0)
1907
+ accepted_count Int @default(0)
1908
+ rejected_count Int @default(0)
1909
+ unsure_count Int @default(0)
1910
+ ai_disagreement_count Int @default(0)
1911
+ ai_disagreement_percent Float?
1912
+ avg_difficulty Float?
1913
+ avg_supportiveness Float?
1914
+ avg_topics_coverage_percent Float?
1915
+
1916
+ @@unique([snapshot_date, organisation_id, user_id, job_description_id])
1917
+ @@index([snapshot_date], map: "ijad_snapshot_date_idx")
1918
+ @@index([snapshot_date, organisation_id, job_description_id], map: "ijad_snapshot_org_job_idx")
1919
+ @@index([snapshot_date, organisation_id, hiring_manager_id], map: "ijad_snapshot_org_hm_idx")
1920
+ @@index([snapshot_date, organisation_id, department], map: "ijad_snapshot_org_dept_idx")
1921
+ @@index([snapshot_date, organisation_id, location], map: "ijad_snapshot_org_loc_idx")
1922
+ @@index([snapshot_date, organisation_id, user_id], map: "ijad_snapshot_org_user_idx")
1923
+ @@map("interviewer_job_analytics_daily")
1924
+ @@schema("analytics")
1925
+ }
1926
+
1927
+ enum JobApplicationFieldType {
1928
+ TEXT
1929
+ NUMBER
1930
+ DATE
1931
+ BOOLEAN
1932
+ MULTI_SELECT
1933
+ FILE
1934
+ DROP_DOWN
1935
+
1936
+ @@schema("public")
1937
+ }
1938
+
1939
+ model JobApplicationField {
1940
+ /// Primary key (UUID)
1941
+ id String @id @default(uuid())
1942
+ /// Foreign keys
1943
+ organisation_id String
1944
+ template_id String
1945
+ /// Data fields
1946
+ field_type JobApplicationFieldType
1947
+ label String
1948
+ description String?
1949
+ is_mandatory Boolean @default(false)
1950
+ is_draft Boolean @default(true)
1951
+ options String[]
1952
+ /// Audit fields
1953
+ is_active Boolean @default(true)
1954
+ created_by String
1955
+ updated_by String
1956
+ created_at DateTime @default(now())
1957
+ updated_at DateTime @updatedAt
1958
+ /// Relations
1959
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1960
+ job_application_template JobApplicationTemplate @relation(fields: [template_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1961
+ job_application_responses JobApplicationResponse[]
1962
+
1963
+ /// Indexes
1964
+ @@index([organisation_id, template_id])
1965
+ @@schema("public")
1966
+ }
1967
+
1968
+ model JobApplicationResponse {
1128
1969
  /// Primary key
1129
1970
  id String @id @default(uuid())
1130
1971
  /// Foreign keys
@@ -1156,11 +1997,14 @@ model JobApplicationResponse {
1156
1997
  /// Partial unique on (application_id, job_application_field_id) WHERE job_application_field_id IS NOT NULL — see migration SQL
1157
1998
  @@index([application_id])
1158
1999
  @@index([job_application_field_id])
2000
+ @@schema("public")
1159
2001
  }
1160
2002
 
1161
2003
  enum JobApplicationTemplateScope {
1162
2004
  ORGANIZATION
1163
2005
  JOB
2006
+
2007
+ @@schema("public")
1164
2008
  }
1165
2009
 
1166
2010
  model JobApplicationTemplate {
@@ -1187,6 +2031,7 @@ model JobApplicationTemplate {
1187
2031
  /// Indexes
1188
2032
  @@index([organisation_id, scope])
1189
2033
  @@index([job_description_id])
2034
+ @@schema("public")
1190
2035
  }
1191
2036
 
1192
2037
  enum JobDescriptionStatus {
@@ -1195,58 +2040,66 @@ enum JobDescriptionStatus {
1195
2040
  ACTIVE
1196
2041
  DEACTIVATED
1197
2042
  CLOSED
2043
+
2044
+ @@schema("public")
1198
2045
  }
1199
2046
 
1200
2047
  model JobDescription {
1201
- id String @id @default(uuid())
2048
+ id String @id @default(uuid())
1202
2049
  organisation_id String
1203
2050
  hiring_manager_id String?
1204
- status JobDescriptionStatus @default(DRAFT)
2051
+ status JobDescriptionStatus @default(DRAFT)
1205
2052
  screeningQuestions String[]
1206
2053
  recommendedQuestions Json[]
1207
2054
  /// @deprecated Prefer `source_document_id` + `Document` (type JOB_DESCRIPTION).
1208
2055
  uploaded_job_description_path String?
1209
- source_document_id String? @unique
1210
- rendered_jd_document_id String? @unique
1211
- rendered_jd_document Document? @relation("RenderedJdDocument", fields: [rendered_jd_document_id], references: [id], onDelete: SetNull)
1212
- is_plan_published Boolean @default(false)
1213
- is_posted Boolean @default(false)
2056
+ source_document_id String? @unique
2057
+ rendered_jd_document_id String? @unique
2058
+ rendered_jd_document Document? @relation("RenderedJdDocument", fields: [rendered_jd_document_id], references: [id], onDelete: SetNull)
2059
+ is_plan_published Boolean @default(false)
2060
+ is_posted Boolean @default(false)
1214
2061
  summary Json?
1215
2062
  ai_insight Json?
1216
2063
  job_fit_comparison Json?
2064
+ target_closing_date DateTime?
2065
+ closing_date DateTime?
2066
+
2067
+ job_number Int?
2068
+ job_code String? @unique
1217
2069
  // Audit fields
1218
- created_at DateTime @default(now())
1219
- updated_at DateTime @updatedAt
1220
- created_by String
1221
- updated_by String
1222
- is_active Boolean @default(true)
1223
- openings Int @default(1)
1224
- job_profile_id String?
1225
- job_profile JobProfile? @relation(fields: [job_profile_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1226
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1227
- source_document Document? @relation("SourceDocument", fields: [source_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1228
- applications Application[]
1229
- interviews Interview[]
1230
- assignments Assignment[]
1231
- fit_check FitCheck[] // one-to-many link
1232
- job_description_data JobDescriptionData[] // one-to-many link
1233
- evaluationPlan EvaluationPlan[] // relation to evaluation methods
1234
- ongoing_evaluations OngoingEvaluation[] // optional one-to-many
1235
- assignment_library AssignmentLibrary[]
1236
- approvals Approval[] // one-to-many relation
1237
- resumes Resume[] // one-to-many link
1238
- budget Budget?
1239
- hiring_manager User? @relation("HiringManager", fields: [hiring_manager_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1240
- recruiters User[]
1241
- transcripts Transcript[]
1242
- integration_job_syncs IntegrationJobSync[]
1243
- job_application_template JobApplicationTemplate?
1244
- conversations Conversation[]
1245
- communication_messages CommunicationMessage[]
2070
+ created_at DateTime @default(now())
2071
+ updated_at DateTime @updatedAt
2072
+ created_by String
2073
+ updated_by String
2074
+ is_active Boolean @default(true)
2075
+ openings Int @default(1)
2076
+ job_profile_id String?
2077
+ job_profile JobProfile? @relation(fields: [job_profile_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2078
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2079
+ source_document Document? @relation("SourceDocument", fields: [source_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2080
+ applications Application[]
2081
+ interviews Interview[]
2082
+ assignments Assignment[]
2083
+ fit_check FitCheck[] // one-to-many link
2084
+ job_description_data JobDescriptionData[] // one-to-many link
2085
+ evaluationPlan EvaluationPlan[] // relation to evaluation methods
2086
+ ongoing_evaluations OngoingEvaluation[] // optional one-to-many
2087
+ assignment_library AssignmentLibrary[]
2088
+ approvals Approval[] // one-to-many relation
2089
+ resumes Resume[] // one-to-many link
2090
+ budget Budget?
2091
+ hiring_manager User? @relation("HiringManager", fields: [hiring_manager_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2092
+ recruiters User[]
2093
+ transcripts Transcript[]
2094
+ integration_job_syncs IntegrationJobSync[]
2095
+ job_application_template JobApplicationTemplate?
2096
+ conversations Conversation[]
2097
+ communication_messages CommunicationMessage[]
1246
2098
 
1247
2099
  @@index([organisation_id])
1248
2100
  @@index([hiring_manager_id])
1249
2101
  @@index([job_profile_id])
2102
+ @@schema("public")
1250
2103
  }
1251
2104
 
1252
2105
  model JobDescriptionData {
@@ -1263,6 +2116,7 @@ model JobDescriptionData {
1263
2116
  jobDescription JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1264
2117
 
1265
2118
  @@unique([job_description_id, key])
2119
+ @@schema("public")
1266
2120
  }
1267
2121
 
1268
2122
  enum JobProfileStatus {
@@ -1270,6 +2124,8 @@ enum JobProfileStatus {
1270
2124
  INTAKE_SENT
1271
2125
  INTAKE_IN_PROGRESS
1272
2126
  COMPLETE
2127
+
2128
+ @@schema("public")
1273
2129
  }
1274
2130
 
1275
2131
  model JobProfile {
@@ -1320,6 +2176,109 @@ model JobProfile {
1320
2176
  @@index([hiring_manager_id])
1321
2177
  @@index([assigned_to])
1322
2178
  @@index([created_by])
2179
+ @@schema("public")
2180
+ }
2181
+
2182
+ model JobRoundAnalytics {
2183
+ id String @id @default(uuid())
2184
+
2185
+ organisation_id String
2186
+
2187
+ job_description_id String
2188
+
2189
+ evaluation_plan_id String
2190
+
2191
+ round_name String
2192
+
2193
+ evaluation_category EvaluationCategory?
2194
+
2195
+ job_code String?
2196
+
2197
+ role_title String?
2198
+
2199
+ hiring_manager_id String?
2200
+
2201
+ plan_order_no Int?
2202
+
2203
+ plan_type EvaluationPlanType?
2204
+
2205
+ is_custom Boolean @default(false)
2206
+
2207
+ assigned_count Int @default(0)
2208
+
2209
+ completed_count Int @default(0)
2210
+
2211
+ passed_count Int @default(0)
2212
+
2213
+ failed_count Int @default(0)
2214
+
2215
+ withdrawn_count Int @default(0)
2216
+
2217
+ no_show_count Int @default(0)
2218
+
2219
+ total_completion_minutes BigInt @default(0)
2220
+
2221
+ avg_completion_minutes Float?
2222
+
2223
+ updated_at DateTime @updatedAt
2224
+
2225
+ @@unique([job_description_id, evaluation_plan_id])
2226
+ @@index([organisation_id])
2227
+ @@index([organisation_id, hiring_manager_id])
2228
+ @@index([job_description_id])
2229
+ @@schema("analytics")
2230
+ }
2231
+
2232
+ model JobRoundAnalyticsDaily {
2233
+ id String @id @default(uuid())
2234
+
2235
+ snapshot_date DateTime @db.Date
2236
+
2237
+ organisation_id String
2238
+
2239
+ job_description_id String
2240
+
2241
+ evaluation_plan_id String
2242
+
2243
+ round_name String
2244
+
2245
+ evaluation_category EvaluationCategory?
2246
+
2247
+ job_code String?
2248
+
2249
+ role_title String?
2250
+
2251
+ hiring_manager_id String?
2252
+
2253
+ plan_order_no Int?
2254
+
2255
+ plan_type EvaluationPlanType?
2256
+
2257
+ is_custom Boolean @default(false)
2258
+
2259
+ assigned_count Int @default(0)
2260
+
2261
+ completed_count Int @default(0)
2262
+
2263
+ passed_count Int @default(0)
2264
+
2265
+ failed_count Int @default(0)
2266
+
2267
+ withdrawn_count Int @default(0)
2268
+
2269
+ no_show_count Int @default(0)
2270
+
2271
+ total_completion_minutes BigInt @default(0)
2272
+
2273
+ avg_completion_minutes Float?
2274
+
2275
+ @@unique([snapshot_date, job_description_id, evaluation_plan_id])
2276
+ @@index([snapshot_date], map: "jrad_snapshot_date_idx")
2277
+ @@index([snapshot_date, organisation_id], map: "jrad_snapshot_org_idx")
2278
+ @@index([snapshot_date, organisation_id, hiring_manager_id], map: "jrad_snapshot_org_hm_idx")
2279
+ @@index([snapshot_date, job_description_id], map: "jrad_snapshot_job_idx")
2280
+ @@map("job_round_analytics_daily")
2281
+ @@schema("analytics")
1323
2282
  }
1324
2283
 
1325
2284
  model LiveAnalysis {
@@ -1338,6 +2297,7 @@ model LiveAnalysis {
1338
2297
  interview Interview @relation(fields: [interview_id], references: [id])
1339
2298
 
1340
2299
  @@index([interview_id])
2300
+ @@schema("public")
1341
2301
  }
1342
2302
 
1343
2303
  model Message {
@@ -1354,6 +2314,8 @@ model Message {
1354
2314
  created_by String
1355
2315
  updated_by String
1356
2316
  is_active Boolean @default(true)
2317
+
2318
+ @@schema("public")
1357
2319
  }
1358
2320
 
1359
2321
  model Notes {
@@ -1374,6 +2336,7 @@ model Notes {
1374
2336
 
1375
2337
  @@index([application_id, created_at])
1376
2338
  @@index([user_id, created_at])
2339
+ @@schema("public")
1377
2340
  }
1378
2341
 
1379
2342
  enum OngoingEvaluationState {
@@ -1382,6 +2345,8 @@ enum OngoingEvaluationState {
1382
2345
  CLEARED
1383
2346
  SKIPPED
1384
2347
  NOT_CLEARED
2348
+
2349
+ @@schema("public")
1385
2350
  }
1386
2351
 
1387
2352
  enum OngoingEvaluationRoundStatus {
@@ -1391,6 +2356,8 @@ enum OngoingEvaluationRoundStatus {
1391
2356
  IN_PROGRESS
1392
2357
  PENDING_EVALUATION
1393
2358
  EVALUATED
2359
+
2360
+ @@schema("public")
1394
2361
  }
1395
2362
 
1396
2363
  model OngoingEvaluation {
@@ -1417,6 +2384,7 @@ model OngoingEvaluation {
1417
2384
  description String?
1418
2385
  order_no Int?
1419
2386
  format EvaluationRoundFormat?
2387
+ round_purpose String?
1420
2388
  topics String[]
1421
2389
  assignee String?
1422
2390
  elimination_round Boolean? @default(false)
@@ -1426,6 +2394,7 @@ model OngoingEvaluation {
1426
2394
  deadline Int?
1427
2395
  duration_unit DurationUnit?
1428
2396
  details Json?
2397
+ category EvaluationCategory?
1429
2398
  // Audit Fields
1430
2399
  created_at DateTime @default(now())
1431
2400
  updated_at DateTime @updatedAt
@@ -1447,6 +2416,93 @@ model OngoingEvaluation {
1447
2416
  @@unique([application_id, evaluation_plan_id])
1448
2417
  @@index([application_id])
1449
2418
  @@index([evaluation_plan_id])
2419
+ @@schema("public")
2420
+ }
2421
+
2422
+ model OpenJobAnalytics {
2423
+ id String @id @default(uuid())
2424
+ organisation_id String
2425
+ job_description_id String @unique
2426
+
2427
+ job_code String?
2428
+ job_number Int?
2429
+ role_title String?
2430
+ department String?
2431
+ hiring_manager_id String?
2432
+ hiring_manager_name String?
2433
+ location String?
2434
+ compensation String?
2435
+ vacancies Int @default(1)
2436
+
2437
+ opened_at DateTime
2438
+ target_closing_date DateTime?
2439
+ closing_date DateTime?
2440
+ is_open Boolean @default(true)
2441
+
2442
+ closure_type OpenJobClosureType?
2443
+ time_to_hire_days Int?
2444
+
2445
+ application_count Int @default(0)
2446
+ in_consideration_count Int @default(0)
2447
+ shortlisted_count Int @default(0)
2448
+ filtered_count Int @default(0)
2449
+ in_evaluation_count Int @default(0)
2450
+ offered_count Int @default(0)
2451
+ hired_count Int @default(0)
2452
+
2453
+ updated_at DateTime @updatedAt
2454
+
2455
+ @@index([organisation_id, is_open])
2456
+ @@index([organisation_id, hiring_manager_id])
2457
+ @@index([organisation_id, opened_at])
2458
+ @@index([organisation_id, job_number])
2459
+ @@index([organisation_id, is_open, closure_type, closing_date])
2460
+ @@index([job_description_id])
2461
+ @@map("open_job_analytics")
2462
+ @@schema("analytics")
2463
+ }
2464
+
2465
+ model OpenJobAnalyticsDaily {
2466
+ id String @id @default(uuid())
2467
+ snapshot_date DateTime @db.Date
2468
+ organisation_id String
2469
+ job_description_id String
2470
+
2471
+ job_code String?
2472
+ job_number Int?
2473
+ role_title String?
2474
+ department String?
2475
+ hiring_manager_id String?
2476
+ hiring_manager_name String?
2477
+ location String?
2478
+ compensation String?
2479
+ vacancies Int @default(1)
2480
+
2481
+ opened_at DateTime
2482
+ target_closing_date DateTime?
2483
+ closing_date DateTime?
2484
+ is_open Boolean @default(true)
2485
+
2486
+ closure_type OpenJobClosureType?
2487
+ time_to_hire_days Int?
2488
+
2489
+ application_count Int @default(0)
2490
+ in_consideration_count Int @default(0)
2491
+ shortlisted_count Int @default(0)
2492
+ filtered_count Int @default(0)
2493
+ in_evaluation_count Int @default(0)
2494
+ offered_count Int @default(0)
2495
+ hired_count Int @default(0)
2496
+
2497
+ @@unique([snapshot_date, job_description_id])
2498
+ @@index([snapshot_date], map: "ojad_snapshot_date_idx")
2499
+ @@index([snapshot_date, organisation_id, is_open], map: "ojad_snapshot_org_open_idx")
2500
+ @@index([snapshot_date, organisation_id, hiring_manager_id], map: "ojad_snapshot_org_hm_idx")
2501
+ @@index([snapshot_date, organisation_id, opened_at], map: "ojad_snapshot_org_opened_idx")
2502
+ @@index([snapshot_date, organisation_id, job_number], map: "ojad_snapshot_org_job_num_idx")
2503
+ @@index([snapshot_date, job_description_id], map: "ojad_snapshot_job_idx")
2504
+ @@map("open_job_analytics_daily")
2505
+ @@schema("analytics")
1450
2506
  }
1451
2507
 
1452
2508
  enum OrganisationSize {
@@ -1455,6 +2511,8 @@ enum OrganisationSize {
1455
2511
  FIFTY_ONE_TO_TWO_HUNDRED @map("51-200")
1456
2512
  TWO_HUNDRED_ONE_TO_FIVE_HUNDRED @map("201-500")
1457
2513
  FIVE_HUNDRED_PLUS @map("500+")
2514
+
2515
+ @@schema("public")
1458
2516
  }
1459
2517
 
1460
2518
  model Organisation {
@@ -1469,42 +2527,48 @@ model Organisation {
1469
2527
  company_values Json[]
1470
2528
  allowed_email_domains String[]
1471
2529
 
1472
- interviewers User[]
1473
- created_at DateTime @default(now())
1474
- updated_at DateTime @updatedAt
1475
- created_by String
1476
- updated_by String
1477
- is_active Boolean @default(true)
1478
- alias String? @unique
1479
- logo String?
1480
- applications Application[]
1481
- user_roles UserRole[]
1482
- job_descriptions JobDescription[]
1483
- job_profiles JobProfile[]
1484
- assessment_library AssessmentLibrary[]
1485
- assignment_library AssignmentLibrary[]
1486
- interviews Interview[]
1487
- assignments Assignment[]
1488
- fit_check FitCheck[] // one-to-many link
1489
- resumes Resume[] // one-to-many link
1490
- approvals Approval[] // one-to-many link
1491
- suggestions Suggestion[]
1492
- ongoing_evaluations OngoingEvaluation[] // optional one-to-many
1493
- actions Action[]
1494
- integration_credentials IntegrationCredential[]
1495
- zoho_sync_mappings ZohoSyncMapping[]
1496
- assessments Assessment[]
1497
- timezone String @default("Asia/Kolkata")
1498
- organisation_configs OrganisationConfig[]
2530
+ interviewers User[]
2531
+ created_at DateTime @default(now())
2532
+ updated_at DateTime @updatedAt
2533
+ created_by String
2534
+ updated_by String
2535
+ is_active Boolean @default(true)
2536
+ alias String? @unique
2537
+ logo String?
2538
+ job_sequence Int @default(1)
2539
+ employee_sequence Int @default(1)
2540
+ applications Application[]
2541
+ user_roles UserRole[]
2542
+ job_descriptions JobDescription[]
2543
+ job_profiles JobProfile[]
2544
+ assessment_library AssessmentLibrary[]
2545
+ assignment_library AssignmentLibrary[]
2546
+ interviews Interview[]
2547
+ assignments Assignment[]
2548
+ fit_check FitCheck[] // one-to-many link
2549
+ resumes Resume[] // one-to-many link
2550
+ approvals Approval[] // one-to-many link
2551
+ suggestions Suggestion[]
2552
+ ongoing_evaluations OngoingEvaluation[] // optional one-to-many
2553
+ actions Action[]
2554
+ integration_credentials IntegrationCredential[]
2555
+ zoho_sync_mappings ZohoSyncMapping[]
2556
+ assessments Assessment[]
2557
+ timezone String @default("Asia/Kolkata")
2558
+ organisation_configs OrganisationConfig[]
2559
+ activity_events ActivityEvent[]
2560
+
2561
+ channel_provider_configs ChannelProviderConfig[]
2562
+ conversations Conversation[]
2563
+ communication_messages CommunicationMessage[]
1499
2564
  job_application_fields JobApplicationField[]
1500
2565
  documents Document[]
1501
2566
  job_application_templates JobApplicationTemplate[]
1502
-
1503
- channel_provider_configs ChannelProviderConfig[]
1504
- conversations Conversation[]
1505
- communication_messages CommunicationMessage[]
2567
+ sources Source[]
2568
+ // departments Department[]
1506
2569
 
1507
2570
  @@index([name])
2571
+ @@schema("public")
1508
2572
  }
1509
2573
 
1510
2574
  model OrganisationConfig {
@@ -1518,6 +2582,7 @@ model OrganisationConfig {
1518
2582
 
1519
2583
  @@unique([organisation_id, config_key])
1520
2584
  @@map("organisationConfig")
2585
+ @@schema("public")
1521
2586
  }
1522
2587
 
1523
2588
  model Permission {
@@ -1532,6 +2597,72 @@ model Permission {
1532
2597
  user_roles UserRole?
1533
2598
 
1534
2599
  @@index([created_at])
2600
+ @@schema("public")
2601
+ }
2602
+
2603
+ model PipelineDistributionAnalytics {
2604
+ id String @id @default(uuid())
2605
+ organisation_id String
2606
+ job_description_id String @unique
2607
+
2608
+ job_code String?
2609
+ job_number Int?
2610
+ role_title String?
2611
+ hiring_manager_id String?
2612
+
2613
+ application_count Int @default(0)
2614
+ filtered_in_count Int @default(0)
2615
+ min_fit_score Float?
2616
+
2617
+ experience_screening_count Int @default(0)
2618
+ technical_screening_count Int @default(0)
2619
+ technical_interview_count Int @default(0)
2620
+ business_round_count Int @default(0)
2621
+ behavioral_round_count Int @default(0)
2622
+
2623
+ shortlisted_count Int @default(0)
2624
+
2625
+ updated_at DateTime @updatedAt
2626
+
2627
+ @@index([organisation_id])
2628
+ @@index([organisation_id, hiring_manager_id])
2629
+ @@index([organisation_id, job_number])
2630
+ @@index([job_description_id])
2631
+ @@map("pipeline_distribution_analytics")
2632
+ @@schema("analytics")
2633
+ }
2634
+
2635
+ model PipelineDistributionAnalyticsDaily {
2636
+ id String @id @default(uuid())
2637
+ snapshot_date DateTime @db.Date
2638
+ organisation_id String
2639
+ job_description_id String
2640
+
2641
+ job_code String?
2642
+ job_number Int?
2643
+ role_title String?
2644
+ hiring_manager_id String?
2645
+
2646
+ application_count Int @default(0)
2647
+ filtered_in_count Int @default(0)
2648
+ min_fit_score Float?
2649
+
2650
+ experience_screening_count Int @default(0)
2651
+ technical_screening_count Int @default(0)
2652
+ technical_interview_count Int @default(0)
2653
+ business_round_count Int @default(0)
2654
+ behavioral_round_count Int @default(0)
2655
+
2656
+ shortlisted_count Int @default(0)
2657
+
2658
+ @@unique([snapshot_date, job_description_id])
2659
+ @@index([snapshot_date], map: "pdad_snapshot_date_idx")
2660
+ @@index([snapshot_date, organisation_id], map: "pdad_snapshot_org_idx")
2661
+ @@index([snapshot_date, organisation_id, hiring_manager_id], map: "pdad_snapshot_org_hm_idx")
2662
+ @@index([snapshot_date, organisation_id, job_number], map: "pdad_snapshot_org_job_num_idx")
2663
+ @@index([snapshot_date, job_description_id], map: "pdad_snapshot_job_idx")
2664
+ @@map("pipeline_distribution_analytics_daily")
2665
+ @@schema("analytics")
1535
2666
  }
1536
2667
 
1537
2668
  enum AsyncOperationStatus {
@@ -1541,6 +2672,8 @@ enum AsyncOperationStatus {
1541
2672
  FAILED
1542
2673
  RETRYING
1543
2674
  CANCELLED
2675
+
2676
+ @@schema("public")
1544
2677
  }
1545
2678
 
1546
2679
  model AsyncOperation {
@@ -1572,12 +2705,15 @@ model AsyncOperation {
1572
2705
  @@index([status])
1573
2706
  @@index([operation_name])
1574
2707
  @@index([correlationId])
2708
+ @@schema("public")
1575
2709
  }
1576
2710
 
1577
2711
  enum Difficulty {
1578
2712
  EASY // simple/basic questions
1579
2713
  MEDIUM // moderate difficulty
1580
2714
  HARD // challenging questions
2715
+
2716
+ @@schema("public")
1581
2717
  }
1582
2718
 
1583
2719
  model Question {
@@ -1601,6 +2737,8 @@ model Question {
1601
2737
  assessmentLibrary AssessmentLibrary? @relation(fields: [assessment_library_id], references: [id], onDelete: Cascade)
1602
2738
  evaluationPlan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id], onDelete: SetNull)
1603
2739
  candidateResponse CandidateQuestionResponse[]
2740
+
2741
+ @@schema("public")
1604
2742
  }
1605
2743
 
1606
2744
  model RefreshToken {
@@ -1612,6 +2750,58 @@ model RefreshToken {
1612
2750
  created_at DateTime @default(now())
1613
2751
  updated_at DateTime @updatedAt
1614
2752
  user User @relation("TokenRefresh", fields: [user_id], references: [id], onDelete: Cascade)
2753
+
2754
+ @@schema("public")
2755
+ }
2756
+
2757
+ enum OpenJobClosureType {
2758
+ FILLED
2759
+ CANCELLED
2760
+
2761
+ @@schema("analytics")
2762
+ }
2763
+
2764
+ model ReportingOverviewJobAnalytics {
2765
+ id String @id @default(uuid())
2766
+ organisation_id String
2767
+ job_description_id String @unique
2768
+
2769
+ job_code String?
2770
+ job_number Int?
2771
+ hiring_manager_id String?
2772
+
2773
+ opened_at DateTime
2774
+ target_closing_date DateTime?
2775
+ closing_date DateTime?
2776
+ is_open Boolean @default(true)
2777
+
2778
+ closure_type OpenJobClosureType?
2779
+ time_to_hire_days Int?
2780
+
2781
+ in_consideration_count Int @default(0)
2782
+
2783
+ updated_at DateTime @updatedAt
2784
+
2785
+ recruiters ReportingOverviewJobRecruiter[]
2786
+
2787
+ @@index([organisation_id, is_open])
2788
+ @@index([organisation_id, hiring_manager_id, is_open])
2789
+ @@index([organisation_id, closing_date, closure_type])
2790
+ @@map("reporting_overview_job_analytics")
2791
+ @@schema("analytics")
2792
+ }
2793
+
2794
+ model ReportingOverviewJobRecruiter {
2795
+ id String @id @default(uuid())
2796
+ job_description_id String
2797
+ recruiter_user_id String
2798
+
2799
+ job ReportingOverviewJobAnalytics @relation(fields: [job_description_id], references: [job_description_id], onDelete: Cascade)
2800
+
2801
+ @@unique([job_description_id, recruiter_user_id])
2802
+ @@index([recruiter_user_id])
2803
+ @@map("reporting_overview_job_recruiters")
2804
+ @@schema("analytics")
1615
2805
  }
1616
2806
 
1617
2807
  model Resume {
@@ -1622,9 +2812,9 @@ model Resume {
1622
2812
  /// @deprecated Prefer `document_id` + `Document`. Kept until backfill completes.
1623
2813
  uploaded_resume_path String?
1624
2814
  document_id String? @unique
1625
- /// Latest rendered ATS export document (PDF/DOCX). Mirrors JD `rendered_jd_document_id`.
2815
+ /// Latest ATS template export (PDF). Null until first successful export.
1626
2816
  rendered_export_document_id String? @unique
1627
- /// Last template id used for the linked rendered export (cache key with fingerprints).
2817
+ /// Last chosen ATS layout template id (e.g. ats-classic). Set on first export.
1628
2818
  resume_template_id String?
1629
2819
  /// @deprecated Prefer `Document.file_hash`. Kept for legacy read fallback.
1630
2820
  file_hash String?
@@ -1638,8 +2828,8 @@ model Resume {
1638
2828
  user User? @relation(fields: [user_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1639
2829
  organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1640
2830
  job_description JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1641
- document Document? @relation(fields: [document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1642
- rendered_export_document Document? @relation("RenderedResumeExportDocument", fields: [rendered_export_document_id], references: [id], onDelete: SetNull)
2831
+ document Document? @relation("ResumeSourceDocument", fields: [document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2832
+ rendered_export_document Document? @relation("RenderedResumeExport", fields: [rendered_export_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1643
2833
  applications Application[]
1644
2834
  interviews Interview[]
1645
2835
  ongoing_evaluations OngoingEvaluation[] // optional one-to-many
@@ -1652,6 +2842,7 @@ model Resume {
1652
2842
 
1653
2843
  @@index([user_id])
1654
2844
  @@index([file_hash])
2845
+ @@schema("public")
1655
2846
  }
1656
2847
 
1657
2848
  model ResumeData {
@@ -1668,6 +2859,153 @@ model ResumeData {
1668
2859
  resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1669
2860
 
1670
2861
  @@index([created_at])
2862
+ @@schema("public")
2863
+ }
2864
+
2865
+ enum RoundResult {
2866
+ PASSED
2867
+ FAILED
2868
+
2869
+ @@schema("analytics")
2870
+ }
2871
+
2872
+ model RoundAnalytics {
2873
+ id String @id @default(uuid())
2874
+
2875
+ // Core Dimensions
2876
+ organisation_id String
2877
+
2878
+ application_id String
2879
+
2880
+ candidate_id String
2881
+
2882
+ job_description_id String
2883
+
2884
+ evaluation_plan_id String
2885
+
2886
+ round_id String @unique
2887
+
2888
+ // Round Information
2889
+ round_name String?
2890
+
2891
+ evaluation_category EvaluationCategory?
2892
+
2893
+ round_type RoundType?
2894
+
2895
+ // Lifecycle Timestamps
2896
+ assigned_at DateTime?
2897
+
2898
+ scheduled_at DateTime?
2899
+
2900
+ started_at DateTime?
2901
+
2902
+ completed_at DateTime?
2903
+
2904
+ evaluated_at DateTime?
2905
+
2906
+ round_completed_at DateTime?
2907
+ round_created_at DateTime?
2908
+
2909
+ // Decision
2910
+ round_result RoundResult?
2911
+
2912
+ round_result_at DateTime?
2913
+
2914
+ // Derived Metrics
2915
+ scheduling_duration_minutes Int?
2916
+
2917
+ round_duration_minutes Int?
2918
+
2919
+ feedback_duration_minutes Int?
2920
+
2921
+ decision_duration_minutes Int?
2922
+
2923
+ total_round_duration_minutes Int?
2924
+
2925
+ is_custom Boolean @default(false)
2926
+
2927
+ // Audit
2928
+ created_at DateTime @default(now())
2929
+
2930
+ updated_at DateTime @updatedAt
2931
+
2932
+ @@index([organisation_id])
2933
+ @@index([job_description_id])
2934
+ @@index([application_id])
2935
+ @@index([candidate_id])
2936
+ @@index([evaluation_category])
2937
+ @@index([round_result])
2938
+ @@map("round_analytics")
2939
+ @@schema("analytics")
2940
+ }
2941
+
2942
+ model RoundAnalyticsDaily {
2943
+ id String @id @default(uuid())
2944
+
2945
+ snapshot_date DateTime @db.Date
2946
+
2947
+ // Core Dimensions
2948
+ organisation_id String
2949
+
2950
+ application_id String
2951
+
2952
+ candidate_id String
2953
+
2954
+ job_description_id String
2955
+
2956
+ evaluation_plan_id String
2957
+
2958
+ round_id String
2959
+
2960
+ // Round Information
2961
+ round_name String?
2962
+
2963
+ evaluation_category EvaluationCategory?
2964
+
2965
+ round_type RoundType?
2966
+
2967
+ // Lifecycle Timestamps
2968
+ assigned_at DateTime?
2969
+
2970
+ scheduled_at DateTime?
2971
+
2972
+ started_at DateTime?
2973
+
2974
+ completed_at DateTime?
2975
+
2976
+ evaluated_at DateTime?
2977
+
2978
+ round_completed_at DateTime?
2979
+ round_created_at DateTime?
2980
+
2981
+ // Decision
2982
+ round_result RoundResult?
2983
+
2984
+ round_result_at DateTime?
2985
+
2986
+ // Derived Metrics
2987
+ scheduling_duration_minutes Int?
2988
+
2989
+ round_duration_minutes Int?
2990
+
2991
+ feedback_duration_minutes Int?
2992
+
2993
+ decision_duration_minutes Int?
2994
+
2995
+ total_round_duration_minutes Int?
2996
+
2997
+ is_custom Boolean @default(false)
2998
+
2999
+ @@unique([snapshot_date, round_id])
3000
+ @@index([snapshot_date], map: "rad_snapshot_date_idx")
3001
+ @@index([snapshot_date, organisation_id], map: "rad_snapshot_org_idx")
3002
+ @@index([snapshot_date, job_description_id], map: "rad_snapshot_job_idx")
3003
+ @@index([snapshot_date, application_id], map: "rad_snapshot_app_idx")
3004
+ @@index([snapshot_date, candidate_id], map: "rad_snapshot_candidate_idx")
3005
+ @@index([snapshot_date, evaluation_category], map: "rad_snapshot_eval_cat_idx")
3006
+ @@index([snapshot_date, round_result], map: "rad_snapshot_round_result_idx")
3007
+ @@map("round_analytics_daily")
3008
+ @@schema("analytics")
1671
3009
  }
1672
3010
 
1673
3011
  // This is your Prisma schema file,
@@ -1685,6 +3023,125 @@ generator client {
1685
3023
  datasource db {
1686
3024
  provider = "postgresql"
1687
3025
  url = env("DATABASE_URL")
3026
+
3027
+ schemas = ["public", "analytics"]
3028
+ }
3029
+
3030
+ enum SourceCategory {
3031
+ JOB_BOARD
3032
+ REFERRAL
3033
+ AGENCY
3034
+ SOCIAL_MEDIA
3035
+ CAREERS_PAGE
3036
+ EVENT
3037
+ OTHER
3038
+
3039
+ @@schema("public")
3040
+ }
3041
+
3042
+ model Source {
3043
+ id String @id @default(uuid())
3044
+ organisation_id String
3045
+ name String
3046
+ category SourceCategory?
3047
+ parent_source_id String?
3048
+ colour String?
3049
+ description String?
3050
+ is_active Boolean @default(true)
3051
+ created_at DateTime @default(now())
3052
+ updated_at DateTime @updatedAt
3053
+
3054
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade)
3055
+ parent Source? @relation("SourceHierarchy", fields: [parent_source_id], references: [id], onDelete: SetNull)
3056
+ children Source[] @relation("SourceHierarchy")
3057
+ applications Application[]
3058
+
3059
+ @@unique([organisation_id, name])
3060
+ @@index([organisation_id])
3061
+ @@index([organisation_id, category])
3062
+ @@index([organisation_id, is_active])
3063
+ @@index([parent_source_id])
3064
+ @@schema("public")
3065
+ }
3066
+
3067
+ model SourceEffectivenessAnalytics {
3068
+ id String @id @default(uuid())
3069
+ organisation_id String
3070
+ job_description_id String
3071
+ source_id String
3072
+
3073
+ source_name String
3074
+ source_category SourceCategory?
3075
+ source_colour String?
3076
+ job_code String?
3077
+ job_number Int?
3078
+ role_title String?
3079
+ hiring_manager_id String?
3080
+
3081
+ applications_count Int @default(0)
3082
+ screened_count Int @default(0)
3083
+ evaluated_count Int @default(0)
3084
+ rejected_count Int @default(0)
3085
+ shortlisted_count Int @default(0)
3086
+ offered_count Int @default(0)
3087
+ offer_accepted_count Int @default(0)
3088
+ offer_declined_count Int @default(0)
3089
+ withdrawn_count Int @default(0)
3090
+ hired_count Int @default(0)
3091
+
3092
+ total_fit_score Float @default(0)
3093
+ fit_score_sample_count Int @default(0)
3094
+ average_fit_score Float?
3095
+
3096
+ updated_at DateTime @updatedAt
3097
+
3098
+ @@unique([organisation_id, job_description_id, source_id])
3099
+ @@index([organisation_id])
3100
+ @@index([organisation_id, source_id])
3101
+ @@index([organisation_id, hiring_manager_id])
3102
+ @@index([job_description_id])
3103
+ @@map("source_effectiveness_analytics")
3104
+ @@schema("analytics")
3105
+ }
3106
+
3107
+ model SourceEffectivenessAnalyticsDaily {
3108
+ id String @id @default(uuid())
3109
+ snapshot_date DateTime @db.Date
3110
+ organisation_id String
3111
+ job_description_id String
3112
+ source_id String
3113
+
3114
+ source_name String
3115
+ source_category SourceCategory?
3116
+ source_colour String?
3117
+ job_code String?
3118
+ job_number Int?
3119
+ role_title String?
3120
+ hiring_manager_id String?
3121
+
3122
+ applications_count Int @default(0)
3123
+ screened_count Int @default(0)
3124
+ evaluated_count Int @default(0)
3125
+ rejected_count Int @default(0)
3126
+ shortlisted_count Int @default(0)
3127
+ offered_count Int @default(0)
3128
+ offer_accepted_count Int @default(0)
3129
+ offer_declined_count Int @default(0)
3130
+ withdrawn_count Int @default(0)
3131
+ hired_count Int @default(0)
3132
+
3133
+ total_fit_score Float @default(0)
3134
+ fit_score_sample_count Int @default(0)
3135
+ average_fit_score Float?
3136
+
3137
+ @@unique([snapshot_date, organisation_id, job_description_id, source_id])
3138
+ @@index([snapshot_date], map: "sead_snapshot_date_idx")
3139
+ @@index([snapshot_date, organisation_id], map: "sead_snapshot_org_idx")
3140
+ @@index([snapshot_date, organisation_id, source_id], map: "sead_snapshot_org_source_idx")
3141
+ @@index([snapshot_date, organisation_id, hiring_manager_id], map: "sead_snapshot_org_hm_idx")
3142
+ @@index([snapshot_date, job_description_id], map: "sead_snapshot_job_idx")
3143
+ @@map("source_effectiveness_analytics_daily")
3144
+ @@schema("analytics")
1688
3145
  }
1689
3146
 
1690
3147
  model Suggestion {
@@ -1706,6 +3163,7 @@ model Suggestion {
1706
3163
  organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade)
1707
3164
 
1708
3165
  @@index([interview_id])
3166
+ @@schema("public")
1709
3167
  }
1710
3168
 
1711
3169
  model Transcript {
@@ -1732,17 +3190,22 @@ model Transcript {
1732
3190
  @@unique([interview_id, order_no])
1733
3191
  @@index([interview_id])
1734
3192
  @@index([job_description_id])
3193
+ @@schema("public")
1735
3194
  }
1736
3195
 
1737
3196
  enum FirstLoginStatus {
1738
3197
  PENDING
1739
3198
  COMPLETED
3199
+
3200
+ @@schema("public")
1740
3201
  }
1741
3202
 
1742
3203
  enum UserInvitationStatus {
1743
3204
  INVITED
1744
3205
  ACCEPTED
1745
3206
  EXPIRED
3207
+
3208
+ @@schema("public")
1746
3209
  }
1747
3210
 
1748
3211
  model User {
@@ -1803,6 +3266,7 @@ model User {
1803
3266
  refresh_token_auth RefreshToken[] @relation("TokenRefresh")
1804
3267
  zoom_meeting_participants ZoomMeetingParticipant[]
1805
3268
  notes Notes[]
3269
+ recruiter_applications Application[] @relation("ApplicationRecruiter")
1806
3270
 
1807
3271
  name String?
1808
3272
  phone String?
@@ -1823,9 +3287,14 @@ model User {
1823
3287
  professional_expertise String?
1824
3288
  documents Document[]
1825
3289
 
3290
+ employee_number Int?
3291
+ employee_code String? @unique
3292
+
1826
3293
  @@index([role_id])
1827
3294
  @@index([permission_id])
1828
3295
  @@index([organisation_id])
3296
+ @@index([organisation_id, employee_number])
3297
+ @@schema("public")
1829
3298
  }
1830
3299
 
1831
3300
  model UserProfile {
@@ -1842,12 +3311,16 @@ model UserProfile {
1842
3311
  user_id String? @unique
1843
3312
 
1844
3313
  work_experience Json?
3314
+
3315
+ @@schema("public")
1845
3316
  }
1846
3317
 
1847
3318
  /// Expected attendee slot when persisting interview-linked Zoom participants (`CANDIDATE` | `INTERVIEWER`).
1848
3319
  enum ZoomMeetingParticipantRole {
1849
3320
  CANDIDATE
1850
3321
  INTERVIEWER
3322
+
3323
+ @@schema("public")
1851
3324
  }
1852
3325
 
1853
3326
  /// Zoom meeting linked 1:1 to an interview; Zoom REST host is `zoom_host_user_id`.
@@ -1886,6 +3359,7 @@ model ZoomMeeting {
1886
3359
  @@index([interview_id])
1887
3360
  @@index([zoom_meeting_id])
1888
3361
  @@index([zoom_meeting_uuid])
3362
+ @@schema("public")
1889
3363
  }
1890
3364
 
1891
3365
  /// Expected participants for a `ZoomMeeting`: links to `User` (candidate / interviewer). Replaced on each meeting upsert.
@@ -1909,6 +3383,7 @@ model ZoomMeetingParticipant {
1909
3383
  @@index([zoom_meeting_row_id])
1910
3384
  @@index([user_id])
1911
3385
  @@index([zoom_participant_id])
3386
+ @@schema("public")
1912
3387
  }
1913
3388
 
1914
3389
  /// Ledger of processed Zoom webhook deliveries: one row per `dedupe_key` (request id or body hash).
@@ -1922,4 +3397,5 @@ model ZoomWebhookEvent {
1922
3397
 
1923
3398
  @@index([event])
1924
3399
  @@index([created_at])
3400
+ @@schema("public")
1925
3401
  }