@adaptware/eagles-db 0.4.35 → 0.4.36

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 +11 -869
  2. package/client/index-browser.js +42 -901
  3. package/client/index.d.ts +27423 -80978
  4. package/client/index.js +11 -869
  5. package/client/package.json +1 -1
  6. package/client/schema.prisma +128 -1594
  7. package/client/wasm.js +11 -869
  8. package/package.json +1 -1
  9. package/prisma/schema/CandidateQuestionResponse.prisma +0 -1
  10. package/prisma/schema/UserRole.prisma +0 -1
  11. package/prisma/schema/action.prisma +0 -5
  12. package/prisma/schema/activityLog.prisma +0 -3
  13. package/prisma/schema/applications.prisma +2 -12
  14. package/prisma/schema/approval.prisma +0 -2
  15. package/prisma/schema/assessment.prisma +0 -1
  16. package/prisma/schema/assessmentLibrary.prisma +0 -1
  17. package/prisma/schema/assessmentQuestion.prisma +0 -1
  18. package/prisma/schema/assignment.prisma +0 -3
  19. package/prisma/schema/assignmentLibrary.prisma +0 -1
  20. package/prisma/schema/authModule.prisma +0 -3
  21. package/prisma/schema/budget.prisma +0 -6
  22. package/prisma/schema/calendly.prisma +0 -2
  23. package/prisma/schema/candidateProfile.prisma +0 -2
  24. package/prisma/schema/communication.prisma +0 -11
  25. package/prisma/schema/contactUs.prisma +0 -2
  26. package/prisma/schema/document.prisma +1 -4
  27. package/prisma/schema/evaluationPlan.prisma +10 -35
  28. package/prisma/schema/feedback.prisma +0 -1
  29. package/prisma/schema/fitCheck.prisma +0 -3
  30. package/prisma/schema/google.prisma +0 -2
  31. package/prisma/schema/integration.prisma +0 -13
  32. package/prisma/schema/interview.prisma +0 -9
  33. package/prisma/schema/interviewNotes.prisma +0 -1
  34. package/prisma/schema/jobApplicationFields.prisma +0 -3
  35. package/prisma/schema/jobApplicationResponse.prisma +0 -1
  36. package/prisma/schema/jobApplicationTemplate.prisma +0 -3
  37. package/prisma/schema/jobDescription.prisma +35 -43
  38. package/prisma/schema/jobDescriptionData.prisma +0 -1
  39. package/prisma/schema/jobProfile.prisma +0 -3
  40. package/prisma/schema/liveAnalysis.prisma +0 -1
  41. package/prisma/schema/message.prisma +0 -2
  42. package/prisma/schema/migrations/20260522120000_ongoing_evaluation_record_kind/migration.sql +25 -0
  43. package/prisma/schema/migrations/20260523120000_replace_record_kind_with_is_committed/migration.sql +24 -0
  44. package/prisma/schema/migrations/20260528120000_drop_job_description_recommendation_config/migration.sql +2 -0
  45. package/prisma/schema/migrations/{20260706120000_add_resume_rendered_export → 20260710120000_add_resume_rendered_export_fields}/migration.sql +2 -5
  46. package/prisma/schema/notes.prisma +0 -1
  47. package/prisma/schema/ongoingEvaluation.prisma +0 -7
  48. package/prisma/schema/organisation.prisma +31 -39
  49. package/prisma/schema/organisationConfig.prisma +0 -1
  50. package/prisma/schema/permission.prisma +0 -1
  51. package/prisma/schema/promise.prisma +0 -3
  52. package/prisma/schema/questions.prisma +0 -4
  53. package/prisma/schema/refreshToken.prisma +0 -2
  54. package/prisma/schema/resume.prisma +4 -5
  55. package/prisma/schema/resumeData.prisma +0 -1
  56. package/prisma/schema/schema.prisma +0 -2
  57. package/prisma/schema/suggestion.prisma +0 -1
  58. package/prisma/schema/transcript.prisma +0 -1
  59. package/prisma/schema/user.prisma +0 -10
  60. package/prisma/schema/userProfile.prisma +0 -2
  61. package/prisma/schema/zoomMeeting.prisma +0 -5
  62. package/client/libquery_engine-darwin.dylib.node +0 -0
  63. package/prisma/.DS_Store +0 -0
  64. package/prisma/migrations/20260519120000_migrate_shortlisted_to_selected/migration.sql +0 -2
  65. package/prisma/schema/.DS_Store +0 -0
  66. package/prisma/schema/activityEvent.prisma +0 -138
  67. package/prisma/schema/applicationAnalytics.prisma +0 -87
  68. package/prisma/schema/assessmentRoundAnalytics.prisma +0 -119
  69. package/prisma/schema/assignmentRoundAnalytics.prisma +0 -109
  70. package/prisma/schema/interviewRoundAnalytics.prisma +0 -140
  71. package/prisma/schema/interviewerAnalytics.prisma +0 -129
  72. package/prisma/schema/jobRoundAnalytics.prisma +0 -101
  73. package/prisma/schema/migrations/20260519120000_add_analytics_schema/migration.sql +0 -84
  74. package/prisma/schema/migrations/20260625120000_add_interviewer_analytics/migration.sql +0 -26
  75. package/prisma/schema/migrations/20260629120000_add_user_lifecycle_activity_events/migration.sql +0 -13
  76. package/prisma/schema/migrations/20260629140000_drop_organisation_org_code/migration.sql +0 -2
  77. package/prisma/schema/migrations/20260629160000_employee_codes_dual_interviewer_analytics/migration.sql +0 -87
  78. package/prisma/schema/migrations/20260630120000_add_application_sources/migration.sql +0 -38
  79. package/prisma/schema/migrations/20260701120000_add_source_effectiveness_analytics/migration.sql +0 -40
  80. package/prisma/schema/migrations/20260702120000_add_analytics_daily_tables/migration.sql +0 -232
  81. package/prisma/schema/openJobAnalytics.prisma +0 -85
  82. package/prisma/schema/pipelineDistributionAnalytics.prisma +0 -64
  83. package/prisma/schema/reportingOverviewJobAnalytics.prisma +0 -49
  84. package/prisma/schema/roundAnalytics.prisma +0 -145
  85. package/prisma/schema/source.prisma +0 -36
  86. package/prisma/schema/sourceEffectivenessAnalytics.prisma +0 -79
@@ -21,7 +21,6 @@ model CandidateQuestionResponse {
21
21
  @@unique([assessment_id, question_id, candidate_id])
22
22
  @@index([candidate_id])
23
23
  @@index([assessment_id])
24
- @@schema("public")
25
24
  }
26
25
 
27
26
  model UserRole {
@@ -43,23 +42,18 @@ model UserRole {
43
42
  @@index([role, organisation_id])
44
43
  @@index([organisation_id])
45
44
  @@index([permission_id])
46
- @@schema("public")
47
45
  }
48
46
 
49
47
  enum ActionType {
50
48
  TAKE_INTERVIEW
51
49
  PROVIDE_FEEDBACK
52
50
  SCHEDULE_INTERVIEW
53
-
54
- @@schema("public")
55
51
  }
56
52
 
57
53
  enum ActionStatus {
58
54
  PENDING
59
55
  COMPLETED
60
56
  CANCELLED
61
-
62
- @@schema("public")
63
57
  }
64
58
 
65
59
  model Action {
@@ -84,154 +78,12 @@ model Action {
84
78
  @@index([assignee_id, action_type])
85
79
  @@index([status])
86
80
  @@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")
227
81
  }
228
82
 
229
83
  enum ActivityActorType {
230
84
  USER
231
85
  AI
232
86
  SYSTEM
233
-
234
- @@schema("public")
235
87
  }
236
88
 
237
89
  model ActivityLog {
@@ -249,106 +101,15 @@ model ActivityLog {
249
101
  application Application @relation(fields: [application_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
250
102
 
251
103
  @@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")
341
104
  }
342
105
 
343
106
  // PENDING could be understood as unscreened
344
107
  enum ApplicationStatus {
345
108
  PENDING
346
109
  IN_PROGRESS
347
- SELECTED
348
110
  SHORTLISTED
111
+ SELECTED
349
112
  REJECTED
350
-
351
- @@schema("public")
352
113
  }
353
114
 
354
115
  model Application {
@@ -361,8 +122,6 @@ model Application {
361
122
  applied_at DateTime @default(now())
362
123
  evaluation_plan_id String?
363
124
  fit_check_id String? @unique
364
- recruiter_id String?
365
- source_id String?
366
125
  round_no Int @default(0)
367
126
  is_jaf_completed Boolean @default(false)
368
127
  //Screening fields
@@ -382,16 +141,14 @@ model Application {
382
141
  resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
383
142
  job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
384
143
  fit_check FitCheck? @relation(fields: [fit_check_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
385
- recruiter User? @relation("ApplicationRecruiter", fields: [recruiter_id], references: [id])
386
- source Source? @relation(fields: [source_id], references: [id], onDelete: SetNull)
387
144
  interviews Interview[]
388
145
  assignments Assignment[]
389
146
  ongoing_evaluations OngoingEvaluation[]
390
147
  activity_logs ActivityLog[]
391
148
  notes Notes[]
149
+ job_application_responses JobApplicationResponse[]
392
150
  conversations Conversation[]
393
151
  communication_messages CommunicationMessage[]
394
- job_application_responses JobApplicationResponse[]
395
152
  // Audit fields
396
153
  created_at DateTime @default(now())
397
154
  updated_at DateTime @updatedAt
@@ -402,8 +159,6 @@ model Application {
402
159
  @@unique([candidate_id, job_description_id]) // Ensures candidate applies only once per job
403
160
  @@index([candidate_id])
404
161
  @@index([job_description_id])
405
- @@index([source_id])
406
- @@schema("public")
407
162
  }
408
163
 
409
164
  model Approval {
@@ -419,8 +174,6 @@ model Approval {
419
174
  job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
420
175
  user User @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
421
176
  organisation Organisation @relation(fields: [organisaton_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
422
-
423
- @@schema("public")
424
177
  }
425
178
 
426
179
  model Assessment {
@@ -461,7 +214,6 @@ model Assessment {
461
214
  @@unique([assessment_library_id, candidate_id])
462
215
  @@index([assessment_library_id])
463
216
  @@index([candidate_id])
464
- @@schema("public")
465
217
  }
466
218
 
467
219
  /// Defines how an assessment is conducted.
@@ -484,7 +236,6 @@ model AssessmentLibrary {
484
236
  evaluation_Plans EvaluationPlan[]
485
237
 
486
238
  @@index([organisation_id])
487
- @@schema("public")
488
239
  }
489
240
 
490
241
  /**
@@ -503,135 +254,12 @@ model AssessmentQuestion {
503
254
  updated_at DateTime @updatedAt
504
255
 
505
256
  @@id([assessment_id, question_id])
506
- @@schema("public")
507
- }
508
-
509
- enum AssessmentRoundStatus {
510
- SCHEDULED
511
- IN_PROGRESS
512
- COMPLETED
513
- EVALUATED
514
- CANCELLED
515
-
516
- @@schema("analytics")
517
- }
518
-
519
- model AssessmentRoundAnalytics {
520
- id String @id @default(uuid())
521
-
522
- organisation_id String
523
- round_id String @unique
524
- assessment_id String @unique
525
- application_id String?
526
- candidate_id String
527
- job_description_id String
528
- evaluation_plan_id String
529
-
530
- job_code String?
531
- job_number Int?
532
- role_title String?
533
- hiring_manager_id String?
534
- department String?
535
- location String?
536
-
537
- round_name String?
538
- evaluation_category EvaluationCategory?
539
- round_type RoundType?
540
- round_format EvaluationRoundFormat?
541
- plan_order_no Int?
542
- plan_type EvaluationPlanType?
543
- is_custom Boolean @default(false)
544
-
545
- reviewer_id String?
546
- reviewer_employee_id String?
547
- reviewer_name String?
548
-
549
- candidate_name String?
550
-
551
- evaluation_type EvaluationType?
552
-
553
- scheduled_start_at DateTime?
554
- scheduled_end_at DateTime?
555
- actual_start_at DateTime?
556
- actual_end_at DateTime?
557
- attempt_expires_at DateTime?
558
- evaluated_at DateTime?
559
-
560
- score Float?
561
- status AssessmentRoundStatus?
562
- round_result RoundResult?
563
-
564
- updated_at DateTime @updatedAt
565
-
566
- @@index([organisation_id, evaluated_at])
567
- @@index([organisation_id, reviewer_id])
568
- @@index([job_description_id])
569
- @@index([application_id])
570
- @@map("assessment_round_analytics")
571
- @@schema("analytics")
572
- }
573
-
574
- model AssessmentRoundAnalyticsDaily {
575
- id String @id @default(uuid())
576
-
577
- snapshot_date DateTime @db.Date
578
-
579
- organisation_id String
580
- round_id String
581
- assessment_id String
582
- application_id String?
583
- candidate_id String
584
- job_description_id String
585
- evaluation_plan_id String
586
-
587
- job_code String?
588
- job_number Int?
589
- role_title String?
590
- hiring_manager_id String?
591
- department String?
592
- location String?
593
-
594
- round_name String?
595
- evaluation_category EvaluationCategory?
596
- round_type RoundType?
597
- round_format EvaluationRoundFormat?
598
- plan_order_no Int?
599
- plan_type EvaluationPlanType?
600
- is_custom Boolean @default(false)
601
-
602
- reviewer_id String?
603
- reviewer_employee_id String?
604
- reviewer_name String?
605
-
606
- candidate_name String?
607
-
608
- evaluation_type EvaluationType?
609
-
610
- scheduled_start_at DateTime?
611
- scheduled_end_at DateTime?
612
- actual_start_at DateTime?
613
- actual_end_at DateTime?
614
- attempt_expires_at DateTime?
615
- evaluated_at DateTime?
616
-
617
- score Float?
618
- status AssessmentRoundStatus?
619
- round_result RoundResult?
620
-
621
- @@unique([snapshot_date, assessment_id])
622
- @@index([snapshot_date], map: "asrad_snapshot_date_idx")
623
- @@index([snapshot_date, organisation_id], map: "asrad_snapshot_org_idx")
624
- @@index([snapshot_date, job_description_id], map: "asrad_snapshot_job_idx")
625
- @@map("assessment_round_analytics_daily")
626
- @@schema("analytics")
627
257
  }
628
258
 
629
259
  enum AssignmentStatus {
630
260
  AVAILABLE
631
261
  SCHEDULED
632
262
  CANCELLED
633
-
634
- @@schema("public")
635
263
  }
636
264
 
637
265
  model Assignment {
@@ -675,7 +303,6 @@ model Assignment {
675
303
  @@index([candidate_id])
676
304
  @@index([reviewer_id])
677
305
  @@index([job_description_id])
678
- @@schema("public")
679
306
  }
680
307
 
681
308
  model AssignmentLibrary {
@@ -697,117 +324,6 @@ model AssignmentLibrary {
697
324
  assignments Assignment[]
698
325
 
699
326
  @@index([job_description_id])
700
- @@schema("public")
701
- }
702
-
703
- model AssignmentRoundAnalytics {
704
- id String @id @default(uuid())
705
-
706
- organisation_id String
707
- round_id String @unique
708
- assignment_id String @unique
709
- application_id String?
710
- candidate_id String
711
- job_description_id String
712
- evaluation_plan_id String
713
-
714
- job_code String?
715
- job_number Int?
716
- role_title String?
717
- hiring_manager_id String?
718
- department String?
719
- location String?
720
-
721
- round_name String?
722
- evaluation_category EvaluationCategory?
723
- round_type RoundType?
724
- round_format EvaluationRoundFormat?
725
- plan_order_no Int?
726
- plan_type EvaluationPlanType?
727
- is_custom Boolean @default(false)
728
-
729
- reviewer_id String?
730
- reviewer_employee_id String?
731
- reviewer_name String?
732
-
733
- candidate_name String?
734
-
735
- evaluation_type EvaluationType?
736
-
737
- scheduled_start_at DateTime?
738
- scheduled_end_at DateTime?
739
- completed_at DateTime?
740
- evaluated_at DateTime?
741
- cancelled_at DateTime?
742
-
743
- status AssignmentStatus?
744
- overall_score Int?
745
- cancel_reason String?
746
- round_result RoundResult?
747
-
748
- updated_at DateTime @updatedAt
749
-
750
- @@index([organisation_id, evaluated_at])
751
- @@index([organisation_id, reviewer_id])
752
- @@index([job_description_id])
753
- @@index([application_id])
754
- @@map("assignment_round_analytics")
755
- @@schema("analytics")
756
- }
757
-
758
- model AssignmentRoundAnalyticsDaily {
759
- id String @id @default(uuid())
760
-
761
- snapshot_date DateTime @db.Date
762
-
763
- organisation_id String
764
- round_id String
765
- assignment_id String
766
- application_id String?
767
- candidate_id String
768
- job_description_id String
769
- evaluation_plan_id String
770
-
771
- job_code String?
772
- job_number Int?
773
- role_title String?
774
- hiring_manager_id String?
775
- department String?
776
- location String?
777
-
778
- round_name String?
779
- evaluation_category EvaluationCategory?
780
- round_type RoundType?
781
- round_format EvaluationRoundFormat?
782
- plan_order_no Int?
783
- plan_type EvaluationPlanType?
784
- is_custom Boolean @default(false)
785
-
786
- reviewer_id String?
787
- reviewer_employee_id String?
788
- reviewer_name String?
789
-
790
- candidate_name String?
791
-
792
- evaluation_type EvaluationType?
793
-
794
- scheduled_start_at DateTime?
795
- scheduled_end_at DateTime?
796
- completed_at DateTime?
797
- evaluated_at DateTime?
798
- cancelled_at DateTime?
799
-
800
- status AssignmentStatus?
801
- overall_score Int?
802
- cancel_reason String?
803
- round_result RoundResult?
804
-
805
- @@unique([snapshot_date, assignment_id])
806
- @@index([snapshot_date], map: "arad_snapshot_date_idx")
807
- @@index([snapshot_date, organisation_id], map: "arad_snapshot_org_idx")
808
- @@index([snapshot_date, job_description_id], map: "arad_snapshot_job_idx")
809
- @@map("assignment_round_analytics_daily")
810
- @@schema("analytics")
811
327
  }
812
328
 
813
329
  enum AuthProvider {
@@ -815,8 +331,6 @@ enum AuthProvider {
815
331
  MICROSOFT
816
332
  ZOOM
817
333
  CALENDLY
818
-
819
- @@schema("public")
820
334
  }
821
335
 
822
336
  model AuthModule {
@@ -847,7 +361,6 @@ model AuthModule {
847
361
  @@unique([user_id, provider])
848
362
  @@unique([provider, provider_account_id])
849
363
  @@index([user_id])
850
- @@schema("public")
851
364
  }
852
365
 
853
366
  enum JobType {
@@ -856,8 +369,6 @@ enum JobType {
856
369
  Contract
857
370
  Internship
858
371
  Temporary
859
-
860
- @@schema("public")
861
372
  }
862
373
 
863
374
  enum JDCreationType {
@@ -865,8 +376,6 @@ enum JDCreationType {
865
376
  Upload_JD
866
377
  Create_New
867
378
  Create_From_Profile
868
-
869
- @@schema("public")
870
379
  }
871
380
 
872
381
  model Budget {
@@ -891,8 +400,6 @@ model Budget {
891
400
  created_by String
892
401
  updated_by String
893
402
  is_active Boolean @default(true)
894
-
895
- @@schema("public")
896
403
  }
897
404
 
898
405
  model Calendly {
@@ -912,8 +419,6 @@ model Calendly {
912
419
  created_by String
913
420
  updated_by String
914
421
  is_active Boolean @default(true)
915
-
916
- @@schema("public")
917
422
  }
918
423
 
919
424
  model CandidateProfile {
@@ -941,8 +446,6 @@ model CandidateProfile {
941
446
  veteran_status String?
942
447
  disability_status String?
943
448
  is_active Boolean @default(true)
944
-
945
- @@schema("public")
946
449
  }
947
450
 
948
451
  // Multi-channel communication (WhatsApp, Email, SMS, Call) with provider abstraction.
@@ -953,8 +456,6 @@ enum CommChannel {
953
456
  EMAIL
954
457
  SMS
955
458
  CALL
956
-
957
- @@schema("public")
958
459
  }
959
460
 
960
461
  enum CommProvider {
@@ -967,15 +468,11 @@ enum CommProvider {
967
468
  OUTLOOK
968
469
  GENERIC_SMTP
969
470
  GENERIC
970
-
971
- @@schema("public")
972
471
  }
973
472
 
974
473
  enum CommDirection {
975
474
  INBOUND
976
475
  OUTBOUND
977
-
978
- @@schema("public")
979
476
  }
980
477
 
981
478
  enum CommMessageStatus {
@@ -985,8 +482,6 @@ enum CommMessageStatus {
985
482
  READ
986
483
  FAILED
987
484
  RECEIVED
988
-
989
- @@schema("public")
990
485
  }
991
486
 
992
487
  /// Per-organisation provider selection + (encrypted) credentials for one channel.
@@ -1015,7 +510,6 @@ model ChannelProviderConfig {
1015
510
  @@unique([organisation_id, channel, provider])
1016
511
  @@index([organisation_id, channel])
1017
512
  @@index([organisation_id, channel, is_active])
1018
- @@schema("public")
1019
513
  }
1020
514
 
1021
515
  /// A logical conversation thread with one external party on one channel.
@@ -1060,7 +554,6 @@ model Conversation {
1060
554
  @@index([external_id])
1061
555
  @@index([organisation_id, application_id])
1062
556
  @@index([organisation_id, job_description_id])
1063
- @@schema("public")
1064
557
  }
1065
558
 
1066
559
  /// Individual message in a conversation. Inbound + outbound share the same model.
@@ -1110,7 +603,6 @@ model CommunicationMessage {
1110
603
  @@index([organisation_id, status])
1111
604
  @@index([organisation_id, application_id])
1112
605
  @@index([organisation_id, job_description_id])
1113
- @@schema("public")
1114
606
  }
1115
607
 
1116
608
  model ContactUs {
@@ -1124,8 +616,6 @@ model ContactUs {
1124
616
  createdAt DateTime @default(now())
1125
617
  updatedAt DateTime @updatedAt
1126
618
  is_active Boolean @default(true)
1127
-
1128
- @@schema("public")
1129
619
  }
1130
620
 
1131
621
  model Document {
@@ -1154,6 +644,7 @@ model Document {
1154
644
  organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1155
645
  candidate User? @relation(fields: [candidate_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1156
646
  resume Resume?
647
+ resume_rendered_export Resume? @relation("RenderedResumeExportDocument")
1157
648
  job_description_source JobDescription? @relation("SourceDocument")
1158
649
  job_description_rendered JobDescription? @relation("RenderedJdDocument")
1159
650
  interview_recording Interview?
@@ -1165,7 +656,6 @@ model Document {
1165
656
  @@index([candidate_id])
1166
657
  @@index([organisation_id, candidate_id])
1167
658
  @@index([file_hash])
1168
- @@schema("public")
1169
659
  }
1170
660
 
1171
661
  enum RoundType {
@@ -1173,18 +663,6 @@ enum RoundType {
1173
663
  INTERVIEW
1174
664
  ASSIGNMENT
1175
665
  SCREENING
1176
-
1177
- @@schema("public")
1178
- }
1179
-
1180
- enum EvaluationCategory {
1181
- EXPERIENCE_SCREENING
1182
- TECHNICAL_SCREENING
1183
- TECHNICAL_INTERVIEW
1184
- BUSINESS_ROUND
1185
- BEHAVIORAL_ROUND
1186
-
1187
- @@schema("public")
1188
666
  }
1189
667
 
1190
668
  enum EvaluationRoundFormat {
@@ -1214,8 +692,6 @@ enum EvaluationRoundFormat {
1214
692
  TREADSPACE_AI_ASSISTED
1215
693
  EXTERNAL_VIDEO_AI_ASSISTED
1216
694
  EXTERNAL_VIDEO_UNASSISTED
1217
-
1218
- @@schema("public")
1219
695
  }
1220
696
 
1221
697
  enum EvaluationType {
@@ -1224,32 +700,24 @@ enum EvaluationType {
1224
700
  TREADSPACE_FULL_AI
1225
701
  EXTERNAL_AI_ASSISTED
1226
702
  NON_AI_ASSISTED
1227
-
1228
- @@schema("public")
1229
703
  }
1230
704
 
1231
705
  enum EvaluationPlanType {
1232
706
  CUSTOM
1233
707
  GENERIC
1234
708
  DELETED
1235
-
1236
- @@schema("public")
1237
709
  }
1238
710
 
1239
711
  enum EvaluationPlanShareScope {
1240
712
  PRIVATE
1241
713
  CREATOR
1242
714
  ORGANIZATION
1243
-
1244
- @@schema("public")
1245
715
  }
1246
716
 
1247
717
  enum DurationUnit {
1248
718
  MINUTES
1249
719
  HOURS
1250
720
  DAYS
1251
-
1252
- @@schema("public")
1253
721
  }
1254
722
 
1255
723
  model EvaluationPlan {
@@ -1273,7 +741,6 @@ model EvaluationPlan {
1273
741
  duration Int?
1274
742
  duration_unit DurationUnit?
1275
743
  deadline Int?
1276
- category EvaluationCategory?
1277
744
  created_by String
1278
745
  updated_by String
1279
746
  created_at DateTime @default(now())
@@ -1292,7 +759,6 @@ model EvaluationPlan {
1292
759
  @@index([job_description_id])
1293
760
  @@index([job_description_id, plan_type, share_scope])
1294
761
  @@index([created_by, share_scope])
1295
- @@schema("public")
1296
762
  }
1297
763
 
1298
764
  model Feedback {
@@ -1312,15 +778,12 @@ model Feedback {
1312
778
 
1313
779
  @@unique([interview_id, order_no])
1314
780
  @@index([interview_id])
1315
- @@schema("public")
1316
781
  }
1317
782
 
1318
783
  enum FitCheckStatus {
1319
784
  RECOMMENDED
1320
785
  TO_REVIEW
1321
786
  NOT_RECOMMENDED
1322
-
1323
- @@schema("public")
1324
787
  }
1325
788
 
1326
789
  model FitCheck {
@@ -1374,7 +837,6 @@ model FitCheck {
1374
837
  /// Ensure one FitCheck per (resume_id, job_description_id) pair
1375
838
  @@unique([resume_id, job_description_id])
1376
839
  @@index([resume_id])
1377
- @@schema("public")
1378
840
  }
1379
841
 
1380
842
  model Google {
@@ -1392,8 +854,6 @@ model Google {
1392
854
  created_by String
1393
855
  updated_by String
1394
856
  is_active Boolean @default(true)
1395
-
1396
- @@schema("public")
1397
857
  }
1398
858
 
1399
859
  enum IntegrationProvider {
@@ -1404,24 +864,18 @@ enum IntegrationProvider {
1404
864
  MICROSOFT
1405
865
  ZOOM
1406
866
  CALENDLY
1407
-
1408
- @@schema("public")
1409
867
  }
1410
868
 
1411
869
  enum IntegrationAuthType {
1412
870
  OAUTH2
1413
871
  API_KEY
1414
872
  SSO
1415
-
1416
- @@schema("public")
1417
873
  }
1418
874
 
1419
875
  enum SyncDirection {
1420
876
  PUSH
1421
877
  PULL
1422
878
  BIDIRECTIONAL
1423
-
1424
- @@schema("public")
1425
879
  }
1426
880
 
1427
881
  enum SyncEntityType {
@@ -1429,16 +883,12 @@ enum SyncEntityType {
1429
883
  JOB_OPENING
1430
884
  INTERVIEW
1431
885
  APPLICATION
1432
-
1433
- @@schema("public")
1434
886
  }
1435
887
 
1436
888
  enum SyncStatus {
1437
889
  SYNCED
1438
890
  PENDING
1439
891
  FAILED
1440
-
1441
- @@schema("public")
1442
892
  }
1443
893
 
1444
894
  model IntegrationCredential {
@@ -1463,7 +913,6 @@ model IntegrationCredential {
1463
913
 
1464
914
  @@unique([organisation_id, provider])
1465
915
  @@index([provider])
1466
- @@schema("public")
1467
916
  }
1468
917
 
1469
918
  model IntegrationJobSync {
@@ -1483,7 +932,6 @@ model IntegrationJobSync {
1483
932
 
1484
933
  @@unique([job_description_id, provider])
1485
934
  @@index([provider])
1486
- @@schema("public")
1487
935
  }
1488
936
 
1489
937
  model ZohoSyncMapping {
@@ -1505,7 +953,6 @@ model ZohoSyncMapping {
1505
953
  @@unique([organisation_id, entity_type, treadspace_id])
1506
954
  @@index([zoho_record_id])
1507
955
  @@index([sync_status])
1508
- @@schema("public")
1509
956
  }
1510
957
 
1511
958
  enum InterviewStatus {
@@ -1516,8 +963,6 @@ enum InterviewStatus {
1516
963
  NO_SHOW // Candidate or interviewer failed to appear
1517
964
  EVALUATION_PENDING // Waiting for feedback or evaluation
1518
965
  EVALUATED // Feedback completed and locked
1519
-
1520
- @@schema("public")
1521
966
  }
1522
967
 
1523
968
  enum InterviewFeedback {
@@ -1525,22 +970,16 @@ enum InterviewFeedback {
1525
970
  HIRE
1526
971
  NO_HIRE
1527
972
  STRONG_NO_HIRE
1528
-
1529
- @@schema("public")
1530
973
  }
1531
974
 
1532
975
  enum InterviewPlatform {
1533
976
  TREADSPACE
1534
977
  ZOOM
1535
-
1536
- @@schema("public")
1537
978
  }
1538
979
 
1539
980
  enum AiAssistanceMode {
1540
981
  NONE
1541
982
  ASSISTED
1542
-
1543
- @@schema("public")
1544
983
  }
1545
984
 
1546
985
  model Interview {
@@ -1627,7 +1066,6 @@ model Interview {
1627
1066
  @@index([candidate_id])
1628
1067
  @@index([interviewer_id])
1629
1068
  @@index([job_description_id])
1630
- @@schema("public")
1631
1069
  }
1632
1070
 
1633
1071
  model InterviewNotes {
@@ -1646,319 +1084,44 @@ model InterviewNotes {
1646
1084
  interview Interview @relation(fields: [interview_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1647
1085
 
1648
1086
  @@index([interview_id])
1649
- @@schema("public")
1650
1087
  }
1651
1088
 
1652
- enum InterviewRecommendation {
1653
- ACCEPTED
1654
- REJECTED
1655
- UNSURE
1656
-
1657
- @@schema("analytics")
1089
+ enum JobApplicationFieldType {
1090
+ TEXT
1091
+ NUMBER
1092
+ DATE
1093
+ BOOLEAN
1094
+ MULTI_SELECT
1095
+ FILE
1096
+ DROP_DOWN
1658
1097
  }
1659
1098
 
1660
- model InterviewRoundAnalytics {
1661
- id String @id @default(uuid())
1662
-
1663
- organisation_id String
1664
- round_id String @unique
1665
- interview_id String @unique
1666
- application_id String?
1667
- candidate_id String
1668
- job_description_id String
1669
- evaluation_plan_id String
1670
-
1671
- job_code String?
1672
- job_number Int?
1673
- role_title String?
1674
- hiring_manager_id String?
1675
- department String?
1676
- location String?
1677
-
1678
- round_name String?
1679
- evaluation_category EvaluationCategory?
1680
- round_type RoundType?
1681
- round_format EvaluationRoundFormat?
1682
- plan_order_no Int?
1683
- plan_type EvaluationPlanType?
1684
- is_custom Boolean @default(false)
1685
-
1686
- interviewer_id String?
1687
- interviewer_employee_id String?
1688
- interviewer_name String?
1689
-
1690
- candidate_name String?
1691
- candidate_email String?
1692
-
1693
- evaluation_type EvaluationType?
1694
- ai_assistance_mode AiAssistanceMode?
1695
- interview_platform InterviewPlatform?
1696
- interview_status InterviewStatus?
1697
-
1698
- scheduled_start_at DateTime?
1699
- scheduled_end_at DateTime?
1700
- actual_start_at DateTime?
1701
- actual_end_at DateTime?
1702
- evaluated_at DateTime?
1703
- first_assigned_at DateTime?
1704
- duration_minutes Int?
1705
-
1706
- human_rating String?
1707
- ai_rating String?
1708
- recommendation InterviewRecommendation?
1709
- ai_disagrees_with_ai Boolean?
1710
-
1711
- difficulty_score Float?
1712
- supportiveness_score Float?
1713
- topics_coverage_percent Float?
1714
-
1715
- updated_at DateTime @updatedAt
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[]
1716
1122
 
1717
- @@index([organisation_id, evaluated_at])
1718
- @@index([organisation_id, interviewer_id, evaluated_at])
1719
- @@index([job_description_id])
1720
- @@index([application_id])
1721
- @@index([organisation_id, hiring_manager_id])
1722
- @@map("interview_round_analytics")
1723
- @@schema("analytics")
1724
- }
1725
-
1726
- model InterviewRoundAnalyticsDaily {
1727
- id String @id @default(uuid())
1728
-
1729
- snapshot_date DateTime @db.Date
1730
-
1731
- organisation_id String
1732
- round_id String
1733
- interview_id String
1734
- application_id String?
1735
- candidate_id String
1736
- job_description_id String
1737
- evaluation_plan_id String
1738
-
1739
- job_code String?
1740
- job_number Int?
1741
- role_title String?
1742
- hiring_manager_id String?
1743
- department String?
1744
- location String?
1745
-
1746
- round_name String?
1747
- evaluation_category EvaluationCategory?
1748
- round_type RoundType?
1749
- round_format EvaluationRoundFormat?
1750
- plan_order_no Int?
1751
- plan_type EvaluationPlanType?
1752
- is_custom Boolean @default(false)
1753
-
1754
- interviewer_id String?
1755
- interviewer_employee_id String?
1756
- interviewer_name String?
1757
-
1758
- candidate_name String?
1759
- candidate_email String?
1760
-
1761
- evaluation_type EvaluationType?
1762
- ai_assistance_mode AiAssistanceMode?
1763
- interview_platform InterviewPlatform?
1764
- interview_status InterviewStatus?
1765
-
1766
- scheduled_start_at DateTime?
1767
- scheduled_end_at DateTime?
1768
- actual_start_at DateTime?
1769
- actual_end_at DateTime?
1770
- evaluated_at DateTime?
1771
- first_assigned_at DateTime?
1772
- duration_minutes Int?
1773
-
1774
- human_rating String?
1775
- ai_rating String?
1776
- recommendation InterviewRecommendation?
1777
- ai_disagrees_with_ai Boolean?
1778
-
1779
- difficulty_score Float?
1780
- supportiveness_score Float?
1781
- topics_coverage_percent Float?
1782
-
1783
- @@unique([snapshot_date, interview_id])
1784
- @@index([snapshot_date], map: "irad_snapshot_date_idx")
1785
- @@index([snapshot_date, organisation_id], map: "irad_snapshot_org_idx")
1786
- @@index([snapshot_date, organisation_id, interviewer_id], map: "irad_snapshot_org_interviewer_idx")
1787
- @@index([snapshot_date, job_description_id], map: "irad_snapshot_job_idx")
1788
- @@index([snapshot_date, organisation_id, evaluated_at], map: "irad_snapshot_org_evaluated_idx")
1789
- @@map("interview_round_analytics_daily")
1790
- @@schema("analytics")
1791
- }
1792
-
1793
- model InterviewerOrganisationAnalytics {
1794
- id String @id @default(uuid())
1795
- organisation_id String
1796
- user_id String
1797
-
1798
- name String?
1799
- employee_id String?
1800
-
1801
- interview_count Int @default(0)
1802
- accepted_count Int @default(0)
1803
- rejected_count Int @default(0)
1804
- unsure_count Int @default(0)
1805
- ai_disagreement_count Int @default(0)
1806
- ai_disagreement_percent Float?
1807
- avg_difficulty Float?
1808
- avg_supportiveness Float?
1809
- avg_topics_coverage_percent Float?
1810
-
1811
- updated_at DateTime @updatedAt
1812
-
1813
- @@unique([organisation_id, user_id])
1814
- @@index([organisation_id])
1815
- @@index([organisation_id, user_id])
1816
- @@map("interviewer_organisation_analytics")
1817
- @@schema("analytics")
1818
- }
1819
-
1820
- model InterviewerJobAnalytics {
1821
- id String @id @default(uuid())
1822
- organisation_id String
1823
- user_id String
1824
- job_description_id String
1825
-
1826
- hiring_manager_id String?
1827
- department String?
1828
- location String?
1829
- role_title String?
1830
- job_code String?
1831
- opened_at DateTime?
1832
-
1833
- name String?
1834
- employee_id String?
1835
-
1836
- interview_count Int @default(0)
1837
- accepted_count Int @default(0)
1838
- rejected_count Int @default(0)
1839
- unsure_count Int @default(0)
1840
- ai_disagreement_count Int @default(0)
1841
- ai_disagreement_percent Float?
1842
- avg_difficulty Float?
1843
- avg_supportiveness Float?
1844
- avg_topics_coverage_percent Float?
1845
-
1846
- updated_at DateTime @updatedAt
1847
-
1848
- @@unique([organisation_id, user_id, job_description_id])
1849
- @@index([organisation_id, job_description_id])
1850
- @@index([organisation_id, hiring_manager_id])
1851
- @@index([organisation_id, department])
1852
- @@index([organisation_id, location])
1853
- @@index([organisation_id, user_id])
1854
- @@map("interviewer_job_analytics")
1855
- @@schema("analytics")
1856
- }
1857
-
1858
- model InterviewerOrganisationAnalyticsDaily {
1859
- id String @id @default(uuid())
1860
- snapshot_date DateTime @db.Date
1861
- organisation_id String
1862
- user_id String
1863
-
1864
- name String?
1865
- employee_id String?
1866
-
1867
- interview_count Int @default(0)
1868
- accepted_count Int @default(0)
1869
- rejected_count Int @default(0)
1870
- unsure_count Int @default(0)
1871
- ai_disagreement_count Int @default(0)
1872
- ai_disagreement_percent Float?
1873
- avg_difficulty Float?
1874
- avg_supportiveness Float?
1875
- avg_topics_coverage_percent Float?
1876
-
1877
- @@unique([snapshot_date, organisation_id, user_id])
1878
- @@index([snapshot_date], map: "ioad_snapshot_date_idx")
1879
- @@index([snapshot_date, organisation_id], map: "ioad_snapshot_org_idx")
1880
- @@index([snapshot_date, organisation_id, user_id], map: "ioad_snapshot_org_user_idx")
1881
- @@map("interviewer_organisation_analytics_daily")
1882
- @@schema("analytics")
1883
- }
1884
-
1885
- model InterviewerJobAnalyticsDaily {
1886
- id String @id @default(uuid())
1887
- snapshot_date DateTime @db.Date
1888
- organisation_id String
1889
- user_id String
1890
- job_description_id String
1891
-
1892
- hiring_manager_id String?
1893
- department String?
1894
- location String?
1895
- role_title String?
1896
- job_code String?
1897
- opened_at DateTime?
1898
-
1899
- name String?
1900
- employee_id String?
1901
-
1902
- interview_count Int @default(0)
1903
- accepted_count Int @default(0)
1904
- rejected_count Int @default(0)
1905
- unsure_count Int @default(0)
1906
- ai_disagreement_count Int @default(0)
1907
- ai_disagreement_percent Float?
1908
- avg_difficulty Float?
1909
- avg_supportiveness Float?
1910
- avg_topics_coverage_percent Float?
1911
-
1912
- @@unique([snapshot_date, organisation_id, user_id, job_description_id])
1913
- @@index([snapshot_date], map: "ijad_snapshot_date_idx")
1914
- @@index([snapshot_date, organisation_id, job_description_id], map: "ijad_snapshot_org_job_idx")
1915
- @@index([snapshot_date, organisation_id, hiring_manager_id], map: "ijad_snapshot_org_hm_idx")
1916
- @@index([snapshot_date, organisation_id, department], map: "ijad_snapshot_org_dept_idx")
1917
- @@index([snapshot_date, organisation_id, location], map: "ijad_snapshot_org_loc_idx")
1918
- @@index([snapshot_date, organisation_id, user_id], map: "ijad_snapshot_org_user_idx")
1919
- @@map("interviewer_job_analytics_daily")
1920
- @@schema("analytics")
1921
- }
1922
-
1923
- enum JobApplicationFieldType {
1924
- TEXT
1925
- NUMBER
1926
- DATE
1927
- BOOLEAN
1928
- MULTI_SELECT
1929
- FILE
1930
- DROP_DOWN
1931
-
1932
- @@schema("public")
1933
- }
1934
-
1935
- model JobApplicationField {
1936
- /// Primary key (UUID)
1937
- id String @id @default(uuid())
1938
- /// Foreign keys
1939
- organisation_id String
1940
- template_id String
1941
- /// Data fields
1942
- field_type JobApplicationFieldType
1943
- label String
1944
- description String?
1945
- is_mandatory Boolean @default(false)
1946
- is_draft Boolean @default(true)
1947
- options String[]
1948
- /// Audit fields
1949
- is_active Boolean @default(true)
1950
- created_by String
1951
- updated_by String
1952
- created_at DateTime @default(now())
1953
- updated_at DateTime @updatedAt
1954
- /// Relations
1955
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1956
- job_application_template JobApplicationTemplate @relation(fields: [template_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1957
- job_application_responses JobApplicationResponse[]
1958
-
1959
- /// Indexes
1960
- @@index([organisation_id, template_id])
1961
- @@schema("public")
1123
+ /// Indexes
1124
+ @@index([organisation_id, template_id])
1962
1125
  }
1963
1126
 
1964
1127
  model JobApplicationResponse {
@@ -1993,14 +1156,11 @@ model JobApplicationResponse {
1993
1156
  /// Partial unique on (application_id, job_application_field_id) WHERE job_application_field_id IS NOT NULL — see migration SQL
1994
1157
  @@index([application_id])
1995
1158
  @@index([job_application_field_id])
1996
- @@schema("public")
1997
1159
  }
1998
1160
 
1999
1161
  enum JobApplicationTemplateScope {
2000
1162
  ORGANIZATION
2001
1163
  JOB
2002
-
2003
- @@schema("public")
2004
1164
  }
2005
1165
 
2006
1166
  model JobApplicationTemplate {
@@ -2027,7 +1187,6 @@ model JobApplicationTemplate {
2027
1187
  /// Indexes
2028
1188
  @@index([organisation_id, scope])
2029
1189
  @@index([job_description_id])
2030
- @@schema("public")
2031
1190
  }
2032
1191
 
2033
1192
  enum JobDescriptionStatus {
@@ -2036,66 +1195,58 @@ enum JobDescriptionStatus {
2036
1195
  ACTIVE
2037
1196
  DEACTIVATED
2038
1197
  CLOSED
2039
-
2040
- @@schema("public")
2041
1198
  }
2042
1199
 
2043
1200
  model JobDescription {
2044
- id String @id @default(uuid())
1201
+ id String @id @default(uuid())
2045
1202
  organisation_id String
2046
1203
  hiring_manager_id String?
2047
- status JobDescriptionStatus @default(DRAFT)
1204
+ status JobDescriptionStatus @default(DRAFT)
2048
1205
  screeningQuestions String[]
2049
1206
  recommendedQuestions Json[]
2050
1207
  /// @deprecated Prefer `source_document_id` + `Document` (type JOB_DESCRIPTION).
2051
1208
  uploaded_job_description_path String?
2052
- source_document_id String? @unique
2053
- rendered_jd_document_id String? @unique
2054
- rendered_jd_document Document? @relation("RenderedJdDocument", fields: [rendered_jd_document_id], references: [id], onDelete: SetNull)
2055
- is_plan_published Boolean @default(false)
2056
- is_posted Boolean @default(false)
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)
2057
1214
  summary Json?
2058
1215
  ai_insight Json?
2059
1216
  job_fit_comparison Json?
2060
- target_closing_date DateTime?
2061
- closing_date DateTime?
2062
-
2063
- job_number Int?
2064
- job_code String? @unique
2065
1217
  // Audit fields
2066
- created_at DateTime @default(now())
2067
- updated_at DateTime @updatedAt
2068
- created_by String
2069
- updated_by String
2070
- is_active Boolean @default(true)
2071
- openings Int @default(1)
2072
- job_profile_id String?
2073
- job_profile JobProfile? @relation(fields: [job_profile_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2074
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2075
- source_document Document? @relation("SourceDocument", fields: [source_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2076
- applications Application[]
2077
- interviews Interview[]
2078
- assignments Assignment[]
2079
- fit_check FitCheck[] // one-to-many link
2080
- job_description_data JobDescriptionData[] // one-to-many link
2081
- evaluationPlan EvaluationPlan[] // relation to evaluation methods
2082
- ongoing_evaluations OngoingEvaluation[] // optional one-to-many
2083
- assignment_library AssignmentLibrary[]
2084
- approvals Approval[] // one-to-many relation
2085
- resumes Resume[] // one-to-many link
2086
- budget Budget?
2087
- hiring_manager User? @relation("HiringManager", fields: [hiring_manager_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2088
- recruiters User[]
2089
- transcripts Transcript[]
2090
- integration_job_syncs IntegrationJobSync[]
2091
- job_application_template JobApplicationTemplate?
2092
- conversations Conversation[]
2093
- communication_messages CommunicationMessage[]
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[]
2094
1246
 
2095
1247
  @@index([organisation_id])
2096
1248
  @@index([hiring_manager_id])
2097
1249
  @@index([job_profile_id])
2098
- @@schema("public")
2099
1250
  }
2100
1251
 
2101
1252
  model JobDescriptionData {
@@ -2112,7 +1263,6 @@ model JobDescriptionData {
2112
1263
  jobDescription JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2113
1264
 
2114
1265
  @@unique([job_description_id, key])
2115
- @@schema("public")
2116
1266
  }
2117
1267
 
2118
1268
  enum JobProfileStatus {
@@ -2120,8 +1270,6 @@ enum JobProfileStatus {
2120
1270
  INTAKE_SENT
2121
1271
  INTAKE_IN_PROGRESS
2122
1272
  COMPLETE
2123
-
2124
- @@schema("public")
2125
1273
  }
2126
1274
 
2127
1275
  model JobProfile {
@@ -2172,109 +1320,6 @@ model JobProfile {
2172
1320
  @@index([hiring_manager_id])
2173
1321
  @@index([assigned_to])
2174
1322
  @@index([created_by])
2175
- @@schema("public")
2176
- }
2177
-
2178
- model JobRoundAnalytics {
2179
- id String @id @default(uuid())
2180
-
2181
- organisation_id String
2182
-
2183
- job_description_id String
2184
-
2185
- evaluation_plan_id String
2186
-
2187
- round_name String
2188
-
2189
- evaluation_category EvaluationCategory?
2190
-
2191
- job_code String?
2192
-
2193
- role_title String?
2194
-
2195
- hiring_manager_id String?
2196
-
2197
- plan_order_no Int?
2198
-
2199
- plan_type EvaluationPlanType?
2200
-
2201
- is_custom Boolean @default(false)
2202
-
2203
- assigned_count Int @default(0)
2204
-
2205
- completed_count Int @default(0)
2206
-
2207
- passed_count Int @default(0)
2208
-
2209
- failed_count Int @default(0)
2210
-
2211
- withdrawn_count Int @default(0)
2212
-
2213
- no_show_count Int @default(0)
2214
-
2215
- total_completion_minutes BigInt @default(0)
2216
-
2217
- avg_completion_minutes Float?
2218
-
2219
- updated_at DateTime @updatedAt
2220
-
2221
- @@unique([job_description_id, evaluation_plan_id])
2222
- @@index([organisation_id])
2223
- @@index([organisation_id, hiring_manager_id])
2224
- @@index([job_description_id])
2225
- @@schema("analytics")
2226
- }
2227
-
2228
- model JobRoundAnalyticsDaily {
2229
- id String @id @default(uuid())
2230
-
2231
- snapshot_date DateTime @db.Date
2232
-
2233
- organisation_id String
2234
-
2235
- job_description_id String
2236
-
2237
- evaluation_plan_id String
2238
-
2239
- round_name String
2240
-
2241
- evaluation_category EvaluationCategory?
2242
-
2243
- job_code String?
2244
-
2245
- role_title String?
2246
-
2247
- hiring_manager_id String?
2248
-
2249
- plan_order_no Int?
2250
-
2251
- plan_type EvaluationPlanType?
2252
-
2253
- is_custom Boolean @default(false)
2254
-
2255
- assigned_count Int @default(0)
2256
-
2257
- completed_count Int @default(0)
2258
-
2259
- passed_count Int @default(0)
2260
-
2261
- failed_count Int @default(0)
2262
-
2263
- withdrawn_count Int @default(0)
2264
-
2265
- no_show_count Int @default(0)
2266
-
2267
- total_completion_minutes BigInt @default(0)
2268
-
2269
- avg_completion_minutes Float?
2270
-
2271
- @@unique([snapshot_date, job_description_id, evaluation_plan_id])
2272
- @@index([snapshot_date], map: "jrad_snapshot_date_idx")
2273
- @@index([snapshot_date, organisation_id], map: "jrad_snapshot_org_idx")
2274
- @@index([snapshot_date, organisation_id, hiring_manager_id], map: "jrad_snapshot_org_hm_idx")
2275
- @@index([snapshot_date, job_description_id], map: "jrad_snapshot_job_idx")
2276
- @@map("job_round_analytics_daily")
2277
- @@schema("analytics")
2278
1323
  }
2279
1324
 
2280
1325
  model LiveAnalysis {
@@ -2293,7 +1338,6 @@ model LiveAnalysis {
2293
1338
  interview Interview @relation(fields: [interview_id], references: [id])
2294
1339
 
2295
1340
  @@index([interview_id])
2296
- @@schema("public")
2297
1341
  }
2298
1342
 
2299
1343
  model Message {
@@ -2310,8 +1354,6 @@ model Message {
2310
1354
  created_by String
2311
1355
  updated_by String
2312
1356
  is_active Boolean @default(true)
2313
-
2314
- @@schema("public")
2315
1357
  }
2316
1358
 
2317
1359
  model Notes {
@@ -2332,7 +1374,6 @@ model Notes {
2332
1374
 
2333
1375
  @@index([application_id, created_at])
2334
1376
  @@index([user_id, created_at])
2335
- @@schema("public")
2336
1377
  }
2337
1378
 
2338
1379
  enum OngoingEvaluationState {
@@ -2341,8 +1382,6 @@ enum OngoingEvaluationState {
2341
1382
  CLEARED
2342
1383
  SKIPPED
2343
1384
  NOT_CLEARED
2344
-
2345
- @@schema("public")
2346
1385
  }
2347
1386
 
2348
1387
  enum OngoingEvaluationRoundStatus {
@@ -2352,8 +1391,6 @@ enum OngoingEvaluationRoundStatus {
2352
1391
  IN_PROGRESS
2353
1392
  PENDING_EVALUATION
2354
1393
  EVALUATED
2355
-
2356
- @@schema("public")
2357
1394
  }
2358
1395
 
2359
1396
  model OngoingEvaluation {
@@ -2389,7 +1426,6 @@ model OngoingEvaluation {
2389
1426
  deadline Int?
2390
1427
  duration_unit DurationUnit?
2391
1428
  details Json?
2392
- category EvaluationCategory?
2393
1429
  // Audit Fields
2394
1430
  created_at DateTime @default(now())
2395
1431
  updated_at DateTime @updatedAt
@@ -2411,93 +1447,6 @@ model OngoingEvaluation {
2411
1447
  @@unique([application_id, evaluation_plan_id])
2412
1448
  @@index([application_id])
2413
1449
  @@index([evaluation_plan_id])
2414
- @@schema("public")
2415
- }
2416
-
2417
- model OpenJobAnalytics {
2418
- id String @id @default(uuid())
2419
- organisation_id String
2420
- job_description_id String @unique
2421
-
2422
- job_code String?
2423
- job_number Int?
2424
- role_title String?
2425
- department String?
2426
- hiring_manager_id String?
2427
- hiring_manager_name String?
2428
- location String?
2429
- compensation String?
2430
- vacancies Int @default(1)
2431
-
2432
- opened_at DateTime
2433
- target_closing_date DateTime?
2434
- closing_date DateTime?
2435
- is_open Boolean @default(true)
2436
-
2437
- closure_type OpenJobClosureType?
2438
- time_to_hire_days Int?
2439
-
2440
- application_count Int @default(0)
2441
- in_consideration_count Int @default(0)
2442
- shortlisted_count Int @default(0)
2443
- filtered_count Int @default(0)
2444
- in_evaluation_count Int @default(0)
2445
- offered_count Int @default(0)
2446
- hired_count Int @default(0)
2447
-
2448
- updated_at DateTime @updatedAt
2449
-
2450
- @@index([organisation_id, is_open])
2451
- @@index([organisation_id, hiring_manager_id])
2452
- @@index([organisation_id, opened_at])
2453
- @@index([organisation_id, job_number])
2454
- @@index([organisation_id, is_open, closure_type, closing_date])
2455
- @@index([job_description_id])
2456
- @@map("open_job_analytics")
2457
- @@schema("analytics")
2458
- }
2459
-
2460
- model OpenJobAnalyticsDaily {
2461
- id String @id @default(uuid())
2462
- snapshot_date DateTime @db.Date
2463
- organisation_id String
2464
- job_description_id String
2465
-
2466
- job_code String?
2467
- job_number Int?
2468
- role_title String?
2469
- department String?
2470
- hiring_manager_id String?
2471
- hiring_manager_name String?
2472
- location String?
2473
- compensation String?
2474
- vacancies Int @default(1)
2475
-
2476
- opened_at DateTime
2477
- target_closing_date DateTime?
2478
- closing_date DateTime?
2479
- is_open Boolean @default(true)
2480
-
2481
- closure_type OpenJobClosureType?
2482
- time_to_hire_days Int?
2483
-
2484
- application_count Int @default(0)
2485
- in_consideration_count Int @default(0)
2486
- shortlisted_count Int @default(0)
2487
- filtered_count Int @default(0)
2488
- in_evaluation_count Int @default(0)
2489
- offered_count Int @default(0)
2490
- hired_count Int @default(0)
2491
-
2492
- @@unique([snapshot_date, job_description_id])
2493
- @@index([snapshot_date], map: "ojad_snapshot_date_idx")
2494
- @@index([snapshot_date, organisation_id, is_open], map: "ojad_snapshot_org_open_idx")
2495
- @@index([snapshot_date, organisation_id, hiring_manager_id], map: "ojad_snapshot_org_hm_idx")
2496
- @@index([snapshot_date, organisation_id, opened_at], map: "ojad_snapshot_org_opened_idx")
2497
- @@index([snapshot_date, organisation_id, job_number], map: "ojad_snapshot_org_job_num_idx")
2498
- @@index([snapshot_date, job_description_id], map: "ojad_snapshot_job_idx")
2499
- @@map("open_job_analytics_daily")
2500
- @@schema("analytics")
2501
1450
  }
2502
1451
 
2503
1452
  enum OrganisationSize {
@@ -2506,8 +1455,6 @@ enum OrganisationSize {
2506
1455
  FIFTY_ONE_TO_TWO_HUNDRED @map("51-200")
2507
1456
  TWO_HUNDRED_ONE_TO_FIVE_HUNDRED @map("201-500")
2508
1457
  FIVE_HUNDRED_PLUS @map("500+")
2509
-
2510
- @@schema("public")
2511
1458
  }
2512
1459
 
2513
1460
  model Organisation {
@@ -2522,48 +1469,42 @@ model Organisation {
2522
1469
  company_values Json[]
2523
1470
  allowed_email_domains String[]
2524
1471
 
2525
- interviewers User[]
2526
- created_at DateTime @default(now())
2527
- updated_at DateTime @updatedAt
2528
- created_by String
2529
- updated_by String
2530
- is_active Boolean @default(true)
2531
- alias String? @unique
2532
- logo String?
2533
- job_sequence Int @default(1)
2534
- employee_sequence Int @default(1)
2535
- applications Application[]
2536
- user_roles UserRole[]
2537
- job_descriptions JobDescription[]
2538
- job_profiles JobProfile[]
2539
- assessment_library AssessmentLibrary[]
2540
- assignment_library AssignmentLibrary[]
2541
- interviews Interview[]
2542
- assignments Assignment[]
2543
- fit_check FitCheck[] // one-to-many link
2544
- resumes Resume[] // one-to-many link
2545
- approvals Approval[] // one-to-many link
2546
- suggestions Suggestion[]
2547
- ongoing_evaluations OngoingEvaluation[] // optional one-to-many
2548
- actions Action[]
2549
- integration_credentials IntegrationCredential[]
2550
- zoho_sync_mappings ZohoSyncMapping[]
2551
- assessments Assessment[]
2552
- timezone String @default("Asia/Kolkata")
2553
- organisation_configs OrganisationConfig[]
2554
- activity_events ActivityEvent[]
2555
-
2556
- channel_provider_configs ChannelProviderConfig[]
2557
- conversations Conversation[]
2558
- communication_messages CommunicationMessage[]
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[]
2559
1499
  job_application_fields JobApplicationField[]
2560
1500
  documents Document[]
2561
1501
  job_application_templates JobApplicationTemplate[]
2562
- sources Source[]
2563
- // departments Department[]
1502
+
1503
+ channel_provider_configs ChannelProviderConfig[]
1504
+ conversations Conversation[]
1505
+ communication_messages CommunicationMessage[]
2564
1506
 
2565
1507
  @@index([name])
2566
- @@schema("public")
2567
1508
  }
2568
1509
 
2569
1510
  model OrganisationConfig {
@@ -2577,7 +1518,6 @@ model OrganisationConfig {
2577
1518
 
2578
1519
  @@unique([organisation_id, config_key])
2579
1520
  @@map("organisationConfig")
2580
- @@schema("public")
2581
1521
  }
2582
1522
 
2583
1523
  model Permission {
@@ -2592,72 +1532,6 @@ model Permission {
2592
1532
  user_roles UserRole?
2593
1533
 
2594
1534
  @@index([created_at])
2595
- @@schema("public")
2596
- }
2597
-
2598
- model PipelineDistributionAnalytics {
2599
- id String @id @default(uuid())
2600
- organisation_id String
2601
- job_description_id String @unique
2602
-
2603
- job_code String?
2604
- job_number Int?
2605
- role_title String?
2606
- hiring_manager_id String?
2607
-
2608
- application_count Int @default(0)
2609
- filtered_in_count Int @default(0)
2610
- min_fit_score Float?
2611
-
2612
- experience_screening_count Int @default(0)
2613
- technical_screening_count Int @default(0)
2614
- technical_interview_count Int @default(0)
2615
- business_round_count Int @default(0)
2616
- behavioral_round_count Int @default(0)
2617
-
2618
- shortlisted_count Int @default(0)
2619
-
2620
- updated_at DateTime @updatedAt
2621
-
2622
- @@index([organisation_id])
2623
- @@index([organisation_id, hiring_manager_id])
2624
- @@index([organisation_id, job_number])
2625
- @@index([job_description_id])
2626
- @@map("pipeline_distribution_analytics")
2627
- @@schema("analytics")
2628
- }
2629
-
2630
- model PipelineDistributionAnalyticsDaily {
2631
- id String @id @default(uuid())
2632
- snapshot_date DateTime @db.Date
2633
- organisation_id String
2634
- job_description_id String
2635
-
2636
- job_code String?
2637
- job_number Int?
2638
- role_title String?
2639
- hiring_manager_id String?
2640
-
2641
- application_count Int @default(0)
2642
- filtered_in_count Int @default(0)
2643
- min_fit_score Float?
2644
-
2645
- experience_screening_count Int @default(0)
2646
- technical_screening_count Int @default(0)
2647
- technical_interview_count Int @default(0)
2648
- business_round_count Int @default(0)
2649
- behavioral_round_count Int @default(0)
2650
-
2651
- shortlisted_count Int @default(0)
2652
-
2653
- @@unique([snapshot_date, job_description_id])
2654
- @@index([snapshot_date], map: "pdad_snapshot_date_idx")
2655
- @@index([snapshot_date, organisation_id], map: "pdad_snapshot_org_idx")
2656
- @@index([snapshot_date, organisation_id, hiring_manager_id], map: "pdad_snapshot_org_hm_idx")
2657
- @@index([snapshot_date, organisation_id, job_number], map: "pdad_snapshot_org_job_num_idx")
2658
- @@index([snapshot_date, job_description_id], map: "pdad_snapshot_job_idx")
2659
- @@map("pipeline_distribution_analytics_daily")
2660
- @@schema("analytics")
2661
1535
  }
2662
1536
 
2663
1537
  enum AsyncOperationStatus {
@@ -2667,8 +1541,6 @@ enum AsyncOperationStatus {
2667
1541
  FAILED
2668
1542
  RETRYING
2669
1543
  CANCELLED
2670
-
2671
- @@schema("public")
2672
1544
  }
2673
1545
 
2674
1546
  model AsyncOperation {
@@ -2700,15 +1572,12 @@ model AsyncOperation {
2700
1572
  @@index([status])
2701
1573
  @@index([operation_name])
2702
1574
  @@index([correlationId])
2703
- @@schema("public")
2704
1575
  }
2705
1576
 
2706
1577
  enum Difficulty {
2707
1578
  EASY // simple/basic questions
2708
1579
  MEDIUM // moderate difficulty
2709
1580
  HARD // challenging questions
2710
-
2711
- @@schema("public")
2712
1581
  }
2713
1582
 
2714
1583
  model Question {
@@ -2732,8 +1601,6 @@ model Question {
2732
1601
  assessmentLibrary AssessmentLibrary? @relation(fields: [assessment_library_id], references: [id], onDelete: Cascade)
2733
1602
  evaluationPlan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id], onDelete: SetNull)
2734
1603
  candidateResponse CandidateQuestionResponse[]
2735
-
2736
- @@schema("public")
2737
1604
  }
2738
1605
 
2739
1606
  model RefreshToken {
@@ -2745,84 +1612,37 @@ model RefreshToken {
2745
1612
  created_at DateTime @default(now())
2746
1613
  updated_at DateTime @updatedAt
2747
1614
  user User @relation("TokenRefresh", fields: [user_id], references: [id], onDelete: Cascade)
2748
-
2749
- @@schema("public")
2750
- }
2751
-
2752
- enum OpenJobClosureType {
2753
- FILLED
2754
- CANCELLED
2755
-
2756
- @@schema("analytics")
2757
- }
2758
-
2759
- model ReportingOverviewJobAnalytics {
2760
- id String @id @default(uuid())
2761
- organisation_id String
2762
- job_description_id String @unique
2763
-
2764
- job_code String?
2765
- job_number Int?
2766
- hiring_manager_id String?
2767
-
2768
- opened_at DateTime
2769
- target_closing_date DateTime?
2770
- closing_date DateTime?
2771
- is_open Boolean @default(true)
2772
-
2773
- closure_type OpenJobClosureType?
2774
- time_to_hire_days Int?
2775
-
2776
- in_consideration_count Int @default(0)
2777
-
2778
- updated_at DateTime @updatedAt
2779
-
2780
- recruiters ReportingOverviewJobRecruiter[]
2781
-
2782
- @@index([organisation_id, is_open])
2783
- @@index([organisation_id, hiring_manager_id, is_open])
2784
- @@index([organisation_id, closing_date, closure_type])
2785
- @@map("reporting_overview_job_analytics")
2786
- @@schema("analytics")
2787
- }
2788
-
2789
- model ReportingOverviewJobRecruiter {
2790
- id String @id @default(uuid())
2791
- job_description_id String
2792
- recruiter_user_id String
2793
-
2794
- job ReportingOverviewJobAnalytics @relation(fields: [job_description_id], references: [job_description_id], onDelete: Cascade)
2795
-
2796
- @@unique([job_description_id, recruiter_user_id])
2797
- @@index([recruiter_user_id])
2798
- @@map("reporting_overview_job_recruiters")
2799
- @@schema("analytics")
2800
1615
  }
2801
1616
 
2802
1617
  model Resume {
2803
- id String @id @default(uuid())
2804
- user_id String?
2805
- organisation_id String?
2806
- job_description_id String?
1618
+ id String @id @default(uuid())
1619
+ user_id String?
1620
+ organisation_id String?
1621
+ job_description_id String?
2807
1622
  /// @deprecated Prefer `document_id` + `Document`. Kept until backfill completes.
2808
- uploaded_resume_path String?
2809
- document_id String? @unique
1623
+ uploaded_resume_path String?
1624
+ document_id String? @unique
1625
+ /// Latest rendered ATS export document (PDF/DOCX). Mirrors JD `rendered_jd_document_id`.
1626
+ rendered_export_document_id String? @unique
1627
+ /// Last template id used for the linked rendered export (cache key with fingerprints).
1628
+ resume_template_id String?
2810
1629
  /// @deprecated Prefer `Document.file_hash`. Kept for legacy read fallback.
2811
- file_hash String?
2812
- summary Json?
2813
- created_at DateTime @default(now())
2814
- updated_at DateTime @updatedAt
2815
- created_by String
2816
- updated_by String
2817
- is_active Boolean @default(true)
2818
- name String?
2819
- user User? @relation(fields: [user_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2820
- organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2821
- job_description JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2822
- document Document? @relation(fields: [document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
2823
- applications Application[]
2824
- interviews Interview[]
2825
- ongoing_evaluations OngoingEvaluation[] // optional one-to-many
1630
+ file_hash String?
1631
+ summary Json?
1632
+ created_at DateTime @default(now())
1633
+ updated_at DateTime @updatedAt
1634
+ created_by String
1635
+ updated_by String
1636
+ is_active Boolean @default(true)
1637
+ name String?
1638
+ user User? @relation(fields: [user_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1639
+ organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1640
+ 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)
1643
+ applications Application[]
1644
+ interviews Interview[]
1645
+ ongoing_evaluations OngoingEvaluation[] // optional one-to-many
2826
1646
 
2827
1647
  resume_data ResumeData[] // one-to-many link
2828
1648
  fit_check FitCheck[] // one-to-many link
@@ -2832,7 +1652,6 @@ model Resume {
2832
1652
 
2833
1653
  @@index([user_id])
2834
1654
  @@index([file_hash])
2835
- @@schema("public")
2836
1655
  }
2837
1656
 
2838
1657
  model ResumeData {
@@ -2849,153 +1668,6 @@ model ResumeData {
2849
1668
  resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
2850
1669
 
2851
1670
  @@index([created_at])
2852
- @@schema("public")
2853
- }
2854
-
2855
- enum RoundResult {
2856
- PASSED
2857
- FAILED
2858
-
2859
- @@schema("analytics")
2860
- }
2861
-
2862
- model RoundAnalytics {
2863
- id String @id @default(uuid())
2864
-
2865
- // Core Dimensions
2866
- organisation_id String
2867
-
2868
- application_id String
2869
-
2870
- candidate_id String
2871
-
2872
- job_description_id String
2873
-
2874
- evaluation_plan_id String
2875
-
2876
- round_id String @unique
2877
-
2878
- // Round Information
2879
- round_name String?
2880
-
2881
- evaluation_category EvaluationCategory?
2882
-
2883
- round_type RoundType?
2884
-
2885
- // Lifecycle Timestamps
2886
- assigned_at DateTime?
2887
-
2888
- scheduled_at DateTime?
2889
-
2890
- started_at DateTime?
2891
-
2892
- completed_at DateTime?
2893
-
2894
- evaluated_at DateTime?
2895
-
2896
- round_completed_at DateTime?
2897
- round_created_at DateTime?
2898
-
2899
- // Decision
2900
- round_result RoundResult?
2901
-
2902
- round_result_at DateTime?
2903
-
2904
- // Derived Metrics
2905
- scheduling_duration_minutes Int?
2906
-
2907
- round_duration_minutes Int?
2908
-
2909
- feedback_duration_minutes Int?
2910
-
2911
- decision_duration_minutes Int?
2912
-
2913
- total_round_duration_minutes Int?
2914
-
2915
- is_custom Boolean @default(false)
2916
-
2917
- // Audit
2918
- created_at DateTime @default(now())
2919
-
2920
- updated_at DateTime @updatedAt
2921
-
2922
- @@index([organisation_id])
2923
- @@index([job_description_id])
2924
- @@index([application_id])
2925
- @@index([candidate_id])
2926
- @@index([evaluation_category])
2927
- @@index([round_result])
2928
- @@map("round_analytics")
2929
- @@schema("analytics")
2930
- }
2931
-
2932
- model RoundAnalyticsDaily {
2933
- id String @id @default(uuid())
2934
-
2935
- snapshot_date DateTime @db.Date
2936
-
2937
- // Core Dimensions
2938
- organisation_id String
2939
-
2940
- application_id String
2941
-
2942
- candidate_id String
2943
-
2944
- job_description_id String
2945
-
2946
- evaluation_plan_id String
2947
-
2948
- round_id String
2949
-
2950
- // Round Information
2951
- round_name String?
2952
-
2953
- evaluation_category EvaluationCategory?
2954
-
2955
- round_type RoundType?
2956
-
2957
- // Lifecycle Timestamps
2958
- assigned_at DateTime?
2959
-
2960
- scheduled_at DateTime?
2961
-
2962
- started_at DateTime?
2963
-
2964
- completed_at DateTime?
2965
-
2966
- evaluated_at DateTime?
2967
-
2968
- round_completed_at DateTime?
2969
- round_created_at DateTime?
2970
-
2971
- // Decision
2972
- round_result RoundResult?
2973
-
2974
- round_result_at DateTime?
2975
-
2976
- // Derived Metrics
2977
- scheduling_duration_minutes Int?
2978
-
2979
- round_duration_minutes Int?
2980
-
2981
- feedback_duration_minutes Int?
2982
-
2983
- decision_duration_minutes Int?
2984
-
2985
- total_round_duration_minutes Int?
2986
-
2987
- is_custom Boolean @default(false)
2988
-
2989
- @@unique([snapshot_date, round_id])
2990
- @@index([snapshot_date], map: "rad_snapshot_date_idx")
2991
- @@index([snapshot_date, organisation_id], map: "rad_snapshot_org_idx")
2992
- @@index([snapshot_date, job_description_id], map: "rad_snapshot_job_idx")
2993
- @@index([snapshot_date, application_id], map: "rad_snapshot_app_idx")
2994
- @@index([snapshot_date, candidate_id], map: "rad_snapshot_candidate_idx")
2995
- @@index([snapshot_date, evaluation_category], map: "rad_snapshot_eval_cat_idx")
2996
- @@index([snapshot_date, round_result], map: "rad_snapshot_round_result_idx")
2997
- @@map("round_analytics_daily")
2998
- @@schema("analytics")
2999
1671
  }
3000
1672
 
3001
1673
  // This is your Prisma schema file,
@@ -3013,125 +1685,6 @@ generator client {
3013
1685
  datasource db {
3014
1686
  provider = "postgresql"
3015
1687
  url = env("DATABASE_URL")
3016
-
3017
- schemas = ["public", "analytics"]
3018
- }
3019
-
3020
- enum SourceCategory {
3021
- JOB_BOARD
3022
- REFERRAL
3023
- AGENCY
3024
- SOCIAL_MEDIA
3025
- CAREERS_PAGE
3026
- EVENT
3027
- OTHER
3028
-
3029
- @@schema("public")
3030
- }
3031
-
3032
- model Source {
3033
- id String @id @default(uuid())
3034
- organisation_id String
3035
- name String
3036
- category SourceCategory?
3037
- parent_source_id String?
3038
- colour String?
3039
- description String?
3040
- is_active Boolean @default(true)
3041
- created_at DateTime @default(now())
3042
- updated_at DateTime @updatedAt
3043
-
3044
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade)
3045
- parent Source? @relation("SourceHierarchy", fields: [parent_source_id], references: [id], onDelete: SetNull)
3046
- children Source[] @relation("SourceHierarchy")
3047
- applications Application[]
3048
-
3049
- @@unique([organisation_id, name])
3050
- @@index([organisation_id])
3051
- @@index([organisation_id, category])
3052
- @@index([organisation_id, is_active])
3053
- @@index([parent_source_id])
3054
- @@schema("public")
3055
- }
3056
-
3057
- model SourceEffectivenessAnalytics {
3058
- id String @id @default(uuid())
3059
- organisation_id String
3060
- job_description_id String
3061
- source_id String
3062
-
3063
- source_name String
3064
- source_category SourceCategory?
3065
- source_colour String?
3066
- job_code String?
3067
- job_number Int?
3068
- role_title String?
3069
- hiring_manager_id String?
3070
-
3071
- applications_count Int @default(0)
3072
- screened_count Int @default(0)
3073
- evaluated_count Int @default(0)
3074
- rejected_count Int @default(0)
3075
- shortlisted_count Int @default(0)
3076
- offered_count Int @default(0)
3077
- offer_accepted_count Int @default(0)
3078
- offer_declined_count Int @default(0)
3079
- withdrawn_count Int @default(0)
3080
- hired_count Int @default(0)
3081
-
3082
- total_fit_score Float @default(0)
3083
- fit_score_sample_count Int @default(0)
3084
- average_fit_score Float?
3085
-
3086
- updated_at DateTime @updatedAt
3087
-
3088
- @@unique([organisation_id, job_description_id, source_id])
3089
- @@index([organisation_id])
3090
- @@index([organisation_id, source_id])
3091
- @@index([organisation_id, hiring_manager_id])
3092
- @@index([job_description_id])
3093
- @@map("source_effectiveness_analytics")
3094
- @@schema("analytics")
3095
- }
3096
-
3097
- model SourceEffectivenessAnalyticsDaily {
3098
- id String @id @default(uuid())
3099
- snapshot_date DateTime @db.Date
3100
- organisation_id String
3101
- job_description_id String
3102
- source_id String
3103
-
3104
- source_name String
3105
- source_category SourceCategory?
3106
- source_colour String?
3107
- job_code String?
3108
- job_number Int?
3109
- role_title String?
3110
- hiring_manager_id String?
3111
-
3112
- applications_count Int @default(0)
3113
- screened_count Int @default(0)
3114
- evaluated_count Int @default(0)
3115
- rejected_count Int @default(0)
3116
- shortlisted_count Int @default(0)
3117
- offered_count Int @default(0)
3118
- offer_accepted_count Int @default(0)
3119
- offer_declined_count Int @default(0)
3120
- withdrawn_count Int @default(0)
3121
- hired_count Int @default(0)
3122
-
3123
- total_fit_score Float @default(0)
3124
- fit_score_sample_count Int @default(0)
3125
- average_fit_score Float?
3126
-
3127
- @@unique([snapshot_date, organisation_id, job_description_id, source_id])
3128
- @@index([snapshot_date], map: "sead_snapshot_date_idx")
3129
- @@index([snapshot_date, organisation_id], map: "sead_snapshot_org_idx")
3130
- @@index([snapshot_date, organisation_id, source_id], map: "sead_snapshot_org_source_idx")
3131
- @@index([snapshot_date, organisation_id, hiring_manager_id], map: "sead_snapshot_org_hm_idx")
3132
- @@index([snapshot_date, job_description_id], map: "sead_snapshot_job_idx")
3133
- @@map("source_effectiveness_analytics_daily")
3134
- @@schema("analytics")
3135
1688
  }
3136
1689
 
3137
1690
  model Suggestion {
@@ -3153,7 +1706,6 @@ model Suggestion {
3153
1706
  organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade)
3154
1707
 
3155
1708
  @@index([interview_id])
3156
- @@schema("public")
3157
1709
  }
3158
1710
 
3159
1711
  model Transcript {
@@ -3180,22 +1732,17 @@ model Transcript {
3180
1732
  @@unique([interview_id, order_no])
3181
1733
  @@index([interview_id])
3182
1734
  @@index([job_description_id])
3183
- @@schema("public")
3184
1735
  }
3185
1736
 
3186
1737
  enum FirstLoginStatus {
3187
1738
  PENDING
3188
1739
  COMPLETED
3189
-
3190
- @@schema("public")
3191
1740
  }
3192
1741
 
3193
1742
  enum UserInvitationStatus {
3194
1743
  INVITED
3195
1744
  ACCEPTED
3196
1745
  EXPIRED
3197
-
3198
- @@schema("public")
3199
1746
  }
3200
1747
 
3201
1748
  model User {
@@ -3256,7 +1803,6 @@ model User {
3256
1803
  refresh_token_auth RefreshToken[] @relation("TokenRefresh")
3257
1804
  zoom_meeting_participants ZoomMeetingParticipant[]
3258
1805
  notes Notes[]
3259
- recruiter_applications Application[] @relation("ApplicationRecruiter")
3260
1806
 
3261
1807
  name String?
3262
1808
  phone String?
@@ -3277,14 +1823,9 @@ model User {
3277
1823
  professional_expertise String?
3278
1824
  documents Document[]
3279
1825
 
3280
- employee_number Int?
3281
- employee_code String? @unique
3282
-
3283
1826
  @@index([role_id])
3284
1827
  @@index([permission_id])
3285
1828
  @@index([organisation_id])
3286
- @@index([organisation_id, employee_number])
3287
- @@schema("public")
3288
1829
  }
3289
1830
 
3290
1831
  model UserProfile {
@@ -3301,16 +1842,12 @@ model UserProfile {
3301
1842
  user_id String? @unique
3302
1843
 
3303
1844
  work_experience Json?
3304
-
3305
- @@schema("public")
3306
1845
  }
3307
1846
 
3308
1847
  /// Expected attendee slot when persisting interview-linked Zoom participants (`CANDIDATE` | `INTERVIEWER`).
3309
1848
  enum ZoomMeetingParticipantRole {
3310
1849
  CANDIDATE
3311
1850
  INTERVIEWER
3312
-
3313
- @@schema("public")
3314
1851
  }
3315
1852
 
3316
1853
  /// Zoom meeting linked 1:1 to an interview; Zoom REST host is `zoom_host_user_id`.
@@ -3349,7 +1886,6 @@ model ZoomMeeting {
3349
1886
  @@index([interview_id])
3350
1887
  @@index([zoom_meeting_id])
3351
1888
  @@index([zoom_meeting_uuid])
3352
- @@schema("public")
3353
1889
  }
3354
1890
 
3355
1891
  /// Expected participants for a `ZoomMeeting`: links to `User` (candidate / interviewer). Replaced on each meeting upsert.
@@ -3373,7 +1909,6 @@ model ZoomMeetingParticipant {
3373
1909
  @@index([zoom_meeting_row_id])
3374
1910
  @@index([user_id])
3375
1911
  @@index([zoom_participant_id])
3376
- @@schema("public")
3377
1912
  }
3378
1913
 
3379
1914
  /// Ledger of processed Zoom webhook deliveries: one row per `dedupe_key` (request id or body hash).
@@ -3387,5 +1922,4 @@ model ZoomWebhookEvent {
3387
1922
 
3388
1923
  @@index([event])
3389
1924
  @@index([created_at])
3390
- @@schema("public")
3391
1925
  }