@adaptware/eagles-db 0.4.36 → 0.4.38

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 +870 -10
  2. package/client/index-browser.js +901 -40
  3. package/client/index.d.ts +81764 -27557
  4. package/client/index.js +870 -10
  5. package/client/libquery_engine-darwin.dylib.node +0 -0
  6. package/client/package.json +1 -1
  7. package/client/schema.prisma +1580 -108
  8. package/client/wasm.js +870 -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 +81 -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,89 @@ 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
+ unscreened_count Int @default(0)
2447
+ ongoing_count Int @default(0)
2448
+ selected_count Int @default(0)
2449
+ rejected_count Int @default(0)
2450
+
2451
+ updated_at DateTime @updatedAt
2452
+
2453
+ @@index([organisation_id, is_open])
2454
+ @@index([organisation_id, hiring_manager_id])
2455
+ @@index([organisation_id, opened_at])
2456
+ @@index([organisation_id, job_number])
2457
+ @@index([organisation_id, is_open, closure_type, closing_date])
2458
+ @@index([job_description_id])
2459
+ @@map("open_job_analytics")
2460
+ @@schema("analytics")
2461
+ }
2462
+
2463
+ model OpenJobAnalyticsDaily {
2464
+ id String @id @default(uuid())
2465
+ snapshot_date DateTime @db.Date
2466
+ organisation_id String
2467
+ job_description_id String
2468
+
2469
+ job_code String?
2470
+ job_number Int?
2471
+ role_title String?
2472
+ department String?
2473
+ hiring_manager_id String?
2474
+ hiring_manager_name String?
2475
+ location String?
2476
+ compensation String?
2477
+ vacancies Int @default(1)
2478
+
2479
+ opened_at DateTime
2480
+ target_closing_date DateTime?
2481
+ closing_date DateTime?
2482
+ is_open Boolean @default(true)
2483
+
2484
+ closure_type OpenJobClosureType?
2485
+ time_to_hire_days Int?
2486
+
2487
+ application_count Int @default(0)
2488
+ unscreened_count Int @default(0)
2489
+ ongoing_count Int @default(0)
2490
+ selected_count Int @default(0)
2491
+ rejected_count Int @default(0)
2492
+
2493
+ @@unique([snapshot_date, job_description_id])
2494
+ @@index([snapshot_date], map: "ojad_snapshot_date_idx")
2495
+ @@index([snapshot_date, organisation_id, is_open], map: "ojad_snapshot_org_open_idx")
2496
+ @@index([snapshot_date, organisation_id, hiring_manager_id], map: "ojad_snapshot_org_hm_idx")
2497
+ @@index([snapshot_date, organisation_id, opened_at], map: "ojad_snapshot_org_opened_idx")
2498
+ @@index([snapshot_date, organisation_id, job_number], map: "ojad_snapshot_org_job_num_idx")
2499
+ @@index([snapshot_date, job_description_id], map: "ojad_snapshot_job_idx")
2500
+ @@map("open_job_analytics_daily")
2501
+ @@schema("analytics")
1450
2502
  }
1451
2503
 
1452
2504
  enum OrganisationSize {
@@ -1455,6 +2507,8 @@ enum OrganisationSize {
1455
2507
  FIFTY_ONE_TO_TWO_HUNDRED @map("51-200")
1456
2508
  TWO_HUNDRED_ONE_TO_FIVE_HUNDRED @map("201-500")
1457
2509
  FIVE_HUNDRED_PLUS @map("500+")
2510
+
2511
+ @@schema("public")
1458
2512
  }
1459
2513
 
1460
2514
  model Organisation {
@@ -1469,42 +2523,48 @@ model Organisation {
1469
2523
  company_values Json[]
1470
2524
  allowed_email_domains String[]
1471
2525
 
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[]
2526
+ interviewers User[]
2527
+ created_at DateTime @default(now())
2528
+ updated_at DateTime @updatedAt
2529
+ created_by String
2530
+ updated_by String
2531
+ is_active Boolean @default(true)
2532
+ alias String? @unique
2533
+ logo String?
2534
+ job_sequence Int @default(1)
2535
+ employee_sequence Int @default(1)
2536
+ applications Application[]
2537
+ user_roles UserRole[]
2538
+ job_descriptions JobDescription[]
2539
+ job_profiles JobProfile[]
2540
+ assessment_library AssessmentLibrary[]
2541
+ assignment_library AssignmentLibrary[]
2542
+ interviews Interview[]
2543
+ assignments Assignment[]
2544
+ fit_check FitCheck[] // one-to-many link
2545
+ resumes Resume[] // one-to-many link
2546
+ approvals Approval[] // one-to-many link
2547
+ suggestions Suggestion[]
2548
+ ongoing_evaluations OngoingEvaluation[] // optional one-to-many
2549
+ actions Action[]
2550
+ integration_credentials IntegrationCredential[]
2551
+ zoho_sync_mappings ZohoSyncMapping[]
2552
+ assessments Assessment[]
2553
+ timezone String @default("Asia/Kolkata")
2554
+ organisation_configs OrganisationConfig[]
2555
+ activity_events ActivityEvent[]
2556
+
2557
+ channel_provider_configs ChannelProviderConfig[]
2558
+ conversations Conversation[]
2559
+ communication_messages CommunicationMessage[]
1499
2560
  job_application_fields JobApplicationField[]
1500
2561
  documents Document[]
1501
2562
  job_application_templates JobApplicationTemplate[]
1502
-
1503
- channel_provider_configs ChannelProviderConfig[]
1504
- conversations Conversation[]
1505
- communication_messages CommunicationMessage[]
2563
+ sources Source[]
2564
+ // departments Department[]
1506
2565
 
1507
2566
  @@index([name])
2567
+ @@schema("public")
1508
2568
  }
1509
2569
 
1510
2570
  model OrganisationConfig {
@@ -1518,6 +2578,7 @@ model OrganisationConfig {
1518
2578
 
1519
2579
  @@unique([organisation_id, config_key])
1520
2580
  @@map("organisationConfig")
2581
+ @@schema("public")
1521
2582
  }
1522
2583
 
1523
2584
  model Permission {
@@ -1532,6 +2593,72 @@ model Permission {
1532
2593
  user_roles UserRole?
1533
2594
 
1534
2595
  @@index([created_at])
2596
+ @@schema("public")
2597
+ }
2598
+
2599
+ model PipelineDistributionAnalytics {
2600
+ id String @id @default(uuid())
2601
+ organisation_id String
2602
+ job_description_id String @unique
2603
+
2604
+ job_code String?
2605
+ job_number Int?
2606
+ role_title String?
2607
+ hiring_manager_id String?
2608
+
2609
+ application_count Int @default(0)
2610
+ filtered_in_count Int @default(0)
2611
+ min_fit_score Float?
2612
+
2613
+ experience_screening_count Int @default(0)
2614
+ technical_screening_count Int @default(0)
2615
+ technical_interview_count Int @default(0)
2616
+ business_round_count Int @default(0)
2617
+ behavioral_round_count Int @default(0)
2618
+
2619
+ shortlisted_count Int @default(0)
2620
+
2621
+ updated_at DateTime @updatedAt
2622
+
2623
+ @@index([organisation_id])
2624
+ @@index([organisation_id, hiring_manager_id])
2625
+ @@index([organisation_id, job_number])
2626
+ @@index([job_description_id])
2627
+ @@map("pipeline_distribution_analytics")
2628
+ @@schema("analytics")
2629
+ }
2630
+
2631
+ model PipelineDistributionAnalyticsDaily {
2632
+ id String @id @default(uuid())
2633
+ snapshot_date DateTime @db.Date
2634
+ organisation_id String
2635
+ job_description_id String
2636
+
2637
+ job_code String?
2638
+ job_number Int?
2639
+ role_title String?
2640
+ hiring_manager_id String?
2641
+
2642
+ application_count Int @default(0)
2643
+ filtered_in_count Int @default(0)
2644
+ min_fit_score Float?
2645
+
2646
+ experience_screening_count Int @default(0)
2647
+ technical_screening_count Int @default(0)
2648
+ technical_interview_count Int @default(0)
2649
+ business_round_count Int @default(0)
2650
+ behavioral_round_count Int @default(0)
2651
+
2652
+ shortlisted_count Int @default(0)
2653
+
2654
+ @@unique([snapshot_date, job_description_id])
2655
+ @@index([snapshot_date], map: "pdad_snapshot_date_idx")
2656
+ @@index([snapshot_date, organisation_id], map: "pdad_snapshot_org_idx")
2657
+ @@index([snapshot_date, organisation_id, hiring_manager_id], map: "pdad_snapshot_org_hm_idx")
2658
+ @@index([snapshot_date, organisation_id, job_number], map: "pdad_snapshot_org_job_num_idx")
2659
+ @@index([snapshot_date, job_description_id], map: "pdad_snapshot_job_idx")
2660
+ @@map("pipeline_distribution_analytics_daily")
2661
+ @@schema("analytics")
1535
2662
  }
1536
2663
 
1537
2664
  enum AsyncOperationStatus {
@@ -1541,6 +2668,8 @@ enum AsyncOperationStatus {
1541
2668
  FAILED
1542
2669
  RETRYING
1543
2670
  CANCELLED
2671
+
2672
+ @@schema("public")
1544
2673
  }
1545
2674
 
1546
2675
  model AsyncOperation {
@@ -1572,12 +2701,15 @@ model AsyncOperation {
1572
2701
  @@index([status])
1573
2702
  @@index([operation_name])
1574
2703
  @@index([correlationId])
2704
+ @@schema("public")
1575
2705
  }
1576
2706
 
1577
2707
  enum Difficulty {
1578
2708
  EASY // simple/basic questions
1579
2709
  MEDIUM // moderate difficulty
1580
2710
  HARD // challenging questions
2711
+
2712
+ @@schema("public")
1581
2713
  }
1582
2714
 
1583
2715
  model Question {
@@ -1601,6 +2733,8 @@ model Question {
1601
2733
  assessmentLibrary AssessmentLibrary? @relation(fields: [assessment_library_id], references: [id], onDelete: Cascade)
1602
2734
  evaluationPlan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id], onDelete: SetNull)
1603
2735
  candidateResponse CandidateQuestionResponse[]
2736
+
2737
+ @@schema("public")
1604
2738
  }
1605
2739
 
1606
2740
  model RefreshToken {
@@ -1612,6 +2746,58 @@ model RefreshToken {
1612
2746
  created_at DateTime @default(now())
1613
2747
  updated_at DateTime @updatedAt
1614
2748
  user User @relation("TokenRefresh", fields: [user_id], references: [id], onDelete: Cascade)
2749
+
2750
+ @@schema("public")
2751
+ }
2752
+
2753
+ enum OpenJobClosureType {
2754
+ FILLED
2755
+ CANCELLED
2756
+
2757
+ @@schema("analytics")
2758
+ }
2759
+
2760
+ model ReportingOverviewJobAnalytics {
2761
+ id String @id @default(uuid())
2762
+ organisation_id String
2763
+ job_description_id String @unique
2764
+
2765
+ job_code String?
2766
+ job_number Int?
2767
+ hiring_manager_id String?
2768
+
2769
+ opened_at DateTime
2770
+ target_closing_date DateTime?
2771
+ closing_date DateTime?
2772
+ is_open Boolean @default(true)
2773
+
2774
+ closure_type OpenJobClosureType?
2775
+ time_to_hire_days Int?
2776
+
2777
+ in_consideration_count Int @default(0)
2778
+
2779
+ updated_at DateTime @updatedAt
2780
+
2781
+ recruiters ReportingOverviewJobRecruiter[]
2782
+
2783
+ @@index([organisation_id, is_open])
2784
+ @@index([organisation_id, hiring_manager_id, is_open])
2785
+ @@index([organisation_id, closing_date, closure_type])
2786
+ @@map("reporting_overview_job_analytics")
2787
+ @@schema("analytics")
2788
+ }
2789
+
2790
+ model ReportingOverviewJobRecruiter {
2791
+ id String @id @default(uuid())
2792
+ job_description_id String
2793
+ recruiter_user_id String
2794
+
2795
+ job ReportingOverviewJobAnalytics @relation(fields: [job_description_id], references: [job_description_id], onDelete: Cascade)
2796
+
2797
+ @@unique([job_description_id, recruiter_user_id])
2798
+ @@index([recruiter_user_id])
2799
+ @@map("reporting_overview_job_recruiters")
2800
+ @@schema("analytics")
1615
2801
  }
1616
2802
 
1617
2803
  model Resume {
@@ -1622,9 +2808,9 @@ model Resume {
1622
2808
  /// @deprecated Prefer `document_id` + `Document`. Kept until backfill completes.
1623
2809
  uploaded_resume_path String?
1624
2810
  document_id String? @unique
1625
- /// Latest rendered ATS export document (PDF/DOCX). Mirrors JD `rendered_jd_document_id`.
2811
+ /// Latest ATS template export (PDF). Null until first successful export.
1626
2812
  rendered_export_document_id String? @unique
1627
- /// Last template id used for the linked rendered export (cache key with fingerprints).
2813
+ /// Last chosen ATS layout template id (e.g. ats-classic). Set on first export.
1628
2814
  resume_template_id String?
1629
2815
  /// @deprecated Prefer `Document.file_hash`. Kept for legacy read fallback.
1630
2816
  file_hash String?
@@ -1638,8 +2824,8 @@ model Resume {
1638
2824
  user User? @relation(fields: [user_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1639
2825
  organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1640
2826
  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)
2827
+ document Document? @relation("ResumeSourceDocument", fields: [document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2828
+ rendered_export_document Document? @relation("RenderedResumeExport", fields: [rendered_export_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1643
2829
  applications Application[]
1644
2830
  interviews Interview[]
1645
2831
  ongoing_evaluations OngoingEvaluation[] // optional one-to-many
@@ -1652,6 +2838,7 @@ model Resume {
1652
2838
 
1653
2839
  @@index([user_id])
1654
2840
  @@index([file_hash])
2841
+ @@schema("public")
1655
2842
  }
1656
2843
 
1657
2844
  model ResumeData {
@@ -1668,6 +2855,153 @@ model ResumeData {
1668
2855
  resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1669
2856
 
1670
2857
  @@index([created_at])
2858
+ @@schema("public")
2859
+ }
2860
+
2861
+ enum RoundResult {
2862
+ PASSED
2863
+ FAILED
2864
+
2865
+ @@schema("analytics")
2866
+ }
2867
+
2868
+ model RoundAnalytics {
2869
+ id String @id @default(uuid())
2870
+
2871
+ // Core Dimensions
2872
+ organisation_id String
2873
+
2874
+ application_id String
2875
+
2876
+ candidate_id String
2877
+
2878
+ job_description_id String
2879
+
2880
+ evaluation_plan_id String
2881
+
2882
+ round_id String @unique
2883
+
2884
+ // Round Information
2885
+ round_name String?
2886
+
2887
+ evaluation_category EvaluationCategory?
2888
+
2889
+ round_type RoundType?
2890
+
2891
+ // Lifecycle Timestamps
2892
+ assigned_at DateTime?
2893
+
2894
+ scheduled_at DateTime?
2895
+
2896
+ started_at DateTime?
2897
+
2898
+ completed_at DateTime?
2899
+
2900
+ evaluated_at DateTime?
2901
+
2902
+ round_completed_at DateTime?
2903
+ round_created_at DateTime?
2904
+
2905
+ // Decision
2906
+ round_result RoundResult?
2907
+
2908
+ round_result_at DateTime?
2909
+
2910
+ // Derived Metrics
2911
+ scheduling_duration_minutes Int?
2912
+
2913
+ round_duration_minutes Int?
2914
+
2915
+ feedback_duration_minutes Int?
2916
+
2917
+ decision_duration_minutes Int?
2918
+
2919
+ total_round_duration_minutes Int?
2920
+
2921
+ is_custom Boolean @default(false)
2922
+
2923
+ // Audit
2924
+ created_at DateTime @default(now())
2925
+
2926
+ updated_at DateTime @updatedAt
2927
+
2928
+ @@index([organisation_id])
2929
+ @@index([job_description_id])
2930
+ @@index([application_id])
2931
+ @@index([candidate_id])
2932
+ @@index([evaluation_category])
2933
+ @@index([round_result])
2934
+ @@map("round_analytics")
2935
+ @@schema("analytics")
2936
+ }
2937
+
2938
+ model RoundAnalyticsDaily {
2939
+ id String @id @default(uuid())
2940
+
2941
+ snapshot_date DateTime @db.Date
2942
+
2943
+ // Core Dimensions
2944
+ organisation_id String
2945
+
2946
+ application_id String
2947
+
2948
+ candidate_id String
2949
+
2950
+ job_description_id String
2951
+
2952
+ evaluation_plan_id String
2953
+
2954
+ round_id String
2955
+
2956
+ // Round Information
2957
+ round_name String?
2958
+
2959
+ evaluation_category EvaluationCategory?
2960
+
2961
+ round_type RoundType?
2962
+
2963
+ // Lifecycle Timestamps
2964
+ assigned_at DateTime?
2965
+
2966
+ scheduled_at DateTime?
2967
+
2968
+ started_at DateTime?
2969
+
2970
+ completed_at DateTime?
2971
+
2972
+ evaluated_at DateTime?
2973
+
2974
+ round_completed_at DateTime?
2975
+ round_created_at DateTime?
2976
+
2977
+ // Decision
2978
+ round_result RoundResult?
2979
+
2980
+ round_result_at DateTime?
2981
+
2982
+ // Derived Metrics
2983
+ scheduling_duration_minutes Int?
2984
+
2985
+ round_duration_minutes Int?
2986
+
2987
+ feedback_duration_minutes Int?
2988
+
2989
+ decision_duration_minutes Int?
2990
+
2991
+ total_round_duration_minutes Int?
2992
+
2993
+ is_custom Boolean @default(false)
2994
+
2995
+ @@unique([snapshot_date, round_id])
2996
+ @@index([snapshot_date], map: "rad_snapshot_date_idx")
2997
+ @@index([snapshot_date, organisation_id], map: "rad_snapshot_org_idx")
2998
+ @@index([snapshot_date, job_description_id], map: "rad_snapshot_job_idx")
2999
+ @@index([snapshot_date, application_id], map: "rad_snapshot_app_idx")
3000
+ @@index([snapshot_date, candidate_id], map: "rad_snapshot_candidate_idx")
3001
+ @@index([snapshot_date, evaluation_category], map: "rad_snapshot_eval_cat_idx")
3002
+ @@index([snapshot_date, round_result], map: "rad_snapshot_round_result_idx")
3003
+ @@map("round_analytics_daily")
3004
+ @@schema("analytics")
1671
3005
  }
1672
3006
 
1673
3007
  // This is your Prisma schema file,
@@ -1685,6 +3019,125 @@ generator client {
1685
3019
  datasource db {
1686
3020
  provider = "postgresql"
1687
3021
  url = env("DATABASE_URL")
3022
+
3023
+ schemas = ["public", "analytics"]
3024
+ }
3025
+
3026
+ enum SourceCategory {
3027
+ JOB_BOARD
3028
+ REFERRAL
3029
+ AGENCY
3030
+ SOCIAL_MEDIA
3031
+ CAREERS_PAGE
3032
+ EVENT
3033
+ OTHER
3034
+
3035
+ @@schema("public")
3036
+ }
3037
+
3038
+ model Source {
3039
+ id String @id @default(uuid())
3040
+ organisation_id String
3041
+ name String
3042
+ category SourceCategory?
3043
+ parent_source_id String?
3044
+ colour String?
3045
+ description String?
3046
+ is_active Boolean @default(true)
3047
+ created_at DateTime @default(now())
3048
+ updated_at DateTime @updatedAt
3049
+
3050
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade)
3051
+ parent Source? @relation("SourceHierarchy", fields: [parent_source_id], references: [id], onDelete: SetNull)
3052
+ children Source[] @relation("SourceHierarchy")
3053
+ applications Application[]
3054
+
3055
+ @@unique([organisation_id, name])
3056
+ @@index([organisation_id])
3057
+ @@index([organisation_id, category])
3058
+ @@index([organisation_id, is_active])
3059
+ @@index([parent_source_id])
3060
+ @@schema("public")
3061
+ }
3062
+
3063
+ model SourceEffectivenessAnalytics {
3064
+ id String @id @default(uuid())
3065
+ organisation_id String
3066
+ job_description_id String
3067
+ source_id String
3068
+
3069
+ source_name String
3070
+ source_category SourceCategory?
3071
+ source_colour String?
3072
+ job_code String?
3073
+ job_number Int?
3074
+ role_title String?
3075
+ hiring_manager_id String?
3076
+
3077
+ applications_count Int @default(0)
3078
+ screened_count Int @default(0)
3079
+ evaluated_count Int @default(0)
3080
+ rejected_count Int @default(0)
3081
+ shortlisted_count Int @default(0)
3082
+ offered_count Int @default(0)
3083
+ offer_accepted_count Int @default(0)
3084
+ offer_declined_count Int @default(0)
3085
+ withdrawn_count Int @default(0)
3086
+ hired_count Int @default(0)
3087
+
3088
+ total_fit_score Float @default(0)
3089
+ fit_score_sample_count Int @default(0)
3090
+ average_fit_score Float?
3091
+
3092
+ updated_at DateTime @updatedAt
3093
+
3094
+ @@unique([organisation_id, job_description_id, source_id])
3095
+ @@index([organisation_id])
3096
+ @@index([organisation_id, source_id])
3097
+ @@index([organisation_id, hiring_manager_id])
3098
+ @@index([job_description_id])
3099
+ @@map("source_effectiveness_analytics")
3100
+ @@schema("analytics")
3101
+ }
3102
+
3103
+ model SourceEffectivenessAnalyticsDaily {
3104
+ id String @id @default(uuid())
3105
+ snapshot_date DateTime @db.Date
3106
+ organisation_id String
3107
+ job_description_id String
3108
+ source_id String
3109
+
3110
+ source_name String
3111
+ source_category SourceCategory?
3112
+ source_colour String?
3113
+ job_code String?
3114
+ job_number Int?
3115
+ role_title String?
3116
+ hiring_manager_id String?
3117
+
3118
+ applications_count Int @default(0)
3119
+ screened_count Int @default(0)
3120
+ evaluated_count Int @default(0)
3121
+ rejected_count Int @default(0)
3122
+ shortlisted_count Int @default(0)
3123
+ offered_count Int @default(0)
3124
+ offer_accepted_count Int @default(0)
3125
+ offer_declined_count Int @default(0)
3126
+ withdrawn_count Int @default(0)
3127
+ hired_count Int @default(0)
3128
+
3129
+ total_fit_score Float @default(0)
3130
+ fit_score_sample_count Int @default(0)
3131
+ average_fit_score Float?
3132
+
3133
+ @@unique([snapshot_date, organisation_id, job_description_id, source_id])
3134
+ @@index([snapshot_date], map: "sead_snapshot_date_idx")
3135
+ @@index([snapshot_date, organisation_id], map: "sead_snapshot_org_idx")
3136
+ @@index([snapshot_date, organisation_id, source_id], map: "sead_snapshot_org_source_idx")
3137
+ @@index([snapshot_date, organisation_id, hiring_manager_id], map: "sead_snapshot_org_hm_idx")
3138
+ @@index([snapshot_date, job_description_id], map: "sead_snapshot_job_idx")
3139
+ @@map("source_effectiveness_analytics_daily")
3140
+ @@schema("analytics")
1688
3141
  }
1689
3142
 
1690
3143
  model Suggestion {
@@ -1706,6 +3159,7 @@ model Suggestion {
1706
3159
  organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade)
1707
3160
 
1708
3161
  @@index([interview_id])
3162
+ @@schema("public")
1709
3163
  }
1710
3164
 
1711
3165
  model Transcript {
@@ -1732,17 +3186,22 @@ model Transcript {
1732
3186
  @@unique([interview_id, order_no])
1733
3187
  @@index([interview_id])
1734
3188
  @@index([job_description_id])
3189
+ @@schema("public")
1735
3190
  }
1736
3191
 
1737
3192
  enum FirstLoginStatus {
1738
3193
  PENDING
1739
3194
  COMPLETED
3195
+
3196
+ @@schema("public")
1740
3197
  }
1741
3198
 
1742
3199
  enum UserInvitationStatus {
1743
3200
  INVITED
1744
3201
  ACCEPTED
1745
3202
  EXPIRED
3203
+
3204
+ @@schema("public")
1746
3205
  }
1747
3206
 
1748
3207
  model User {
@@ -1803,6 +3262,7 @@ model User {
1803
3262
  refresh_token_auth RefreshToken[] @relation("TokenRefresh")
1804
3263
  zoom_meeting_participants ZoomMeetingParticipant[]
1805
3264
  notes Notes[]
3265
+ recruiter_applications Application[] @relation("ApplicationRecruiter")
1806
3266
 
1807
3267
  name String?
1808
3268
  phone String?
@@ -1823,9 +3283,14 @@ model User {
1823
3283
  professional_expertise String?
1824
3284
  documents Document[]
1825
3285
 
3286
+ employee_number Int?
3287
+ employee_code String? @unique
3288
+
1826
3289
  @@index([role_id])
1827
3290
  @@index([permission_id])
1828
3291
  @@index([organisation_id])
3292
+ @@index([organisation_id, employee_number])
3293
+ @@schema("public")
1829
3294
  }
1830
3295
 
1831
3296
  model UserProfile {
@@ -1842,12 +3307,16 @@ model UserProfile {
1842
3307
  user_id String? @unique
1843
3308
 
1844
3309
  work_experience Json?
3310
+
3311
+ @@schema("public")
1845
3312
  }
1846
3313
 
1847
3314
  /// Expected attendee slot when persisting interview-linked Zoom participants (`CANDIDATE` | `INTERVIEWER`).
1848
3315
  enum ZoomMeetingParticipantRole {
1849
3316
  CANDIDATE
1850
3317
  INTERVIEWER
3318
+
3319
+ @@schema("public")
1851
3320
  }
1852
3321
 
1853
3322
  /// Zoom meeting linked 1:1 to an interview; Zoom REST host is `zoom_host_user_id`.
@@ -1886,6 +3355,7 @@ model ZoomMeeting {
1886
3355
  @@index([interview_id])
1887
3356
  @@index([zoom_meeting_id])
1888
3357
  @@index([zoom_meeting_uuid])
3358
+ @@schema("public")
1889
3359
  }
1890
3360
 
1891
3361
  /// Expected participants for a `ZoomMeeting`: links to `User` (candidate / interviewer). Replaced on each meeting upsert.
@@ -1909,6 +3379,7 @@ model ZoomMeetingParticipant {
1909
3379
  @@index([zoom_meeting_row_id])
1910
3380
  @@index([user_id])
1911
3381
  @@index([zoom_participant_id])
3382
+ @@schema("public")
1912
3383
  }
1913
3384
 
1914
3385
  /// Ledger of processed Zoom webhook deliveries: one row per `dedupe_key` (request id or body hash).
@@ -1922,4 +3393,5 @@ model ZoomWebhookEvent {
1922
3393
 
1923
3394
  @@index([event])
1924
3395
  @@index([created_at])
3396
+ @@schema("public")
1925
3397
  }