@adaptware/eagles-db 0.1.1

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 (64) hide show
  1. package/README.md +110 -0
  2. package/bin/db-cli.js +113 -0
  3. package/client/client.d.ts +1 -0
  4. package/client/client.js +4 -0
  5. package/client/default.d.ts +1 -0
  6. package/client/default.js +4 -0
  7. package/client/edge.d.ts +1 -0
  8. package/client/edge.js +1039 -0
  9. package/client/index-browser.js +1022 -0
  10. package/client/index.d.ts +94904 -0
  11. package/client/index.js +1064 -0
  12. package/client/libquery_engine-darwin.dylib.node +0 -0
  13. package/client/libquery_engine-linux-arm64-openssl-1.1.x.so.node +0 -0
  14. package/client/package.json +150 -0
  15. package/client/runtime/edge-esm.js +34 -0
  16. package/client/runtime/edge.js +34 -0
  17. package/client/runtime/index-browser.d.ts +370 -0
  18. package/client/runtime/index-browser.js +16 -0
  19. package/client/runtime/library.d.ts +3976 -0
  20. package/client/runtime/library.js +146 -0
  21. package/client/runtime/react-native.js +83 -0
  22. package/client/runtime/wasm-compiler-edge.js +83 -0
  23. package/client/runtime/wasm-engine-edge.js +35 -0
  24. package/client/schema.prisma +1158 -0
  25. package/client/wasm.d.ts +1 -0
  26. package/client/wasm.js +1022 -0
  27. package/package.json +55 -0
  28. package/prisma/schema/CandidateQuestionResponse.prisma +21 -0
  29. package/prisma/schema/UserRole.prisma +20 -0
  30. package/prisma/schema/action.prisma +35 -0
  31. package/prisma/schema/applications.prisma +44 -0
  32. package/prisma/schema/approval.prisma +14 -0
  33. package/prisma/schema/assessment.prisma +40 -0
  34. package/prisma/schema/assessmentLibrary.prisma +33 -0
  35. package/prisma/schema/assessmentQuestion.prisma +17 -0
  36. package/prisma/schema/assignmentLibrary.prisma +20 -0
  37. package/prisma/schema/budget.prisma +38 -0
  38. package/prisma/schema/calendly.prisma +18 -0
  39. package/prisma/schema/candidateProfile.prisma +26 -0
  40. package/prisma/schema/contactUs.prisma +12 -0
  41. package/prisma/schema/evaluationPlan.prisma +91 -0
  42. package/prisma/schema/feedback.prisma +18 -0
  43. package/prisma/schema/fitCheck.prisma +54 -0
  44. package/prisma/schema/google.prisma +16 -0
  45. package/prisma/schema/intermediateFeedback.prisma +18 -0
  46. package/prisma/schema/interview.prisma +65 -0
  47. package/prisma/schema/interviewLibrary.prisma +33 -0
  48. package/prisma/schema/interviewNotes.prisma +17 -0
  49. package/prisma/schema/jobDescription.prisma +43 -0
  50. package/prisma/schema/jobDescriptionData.prisma +16 -0
  51. package/prisma/schema/message.prisma +15 -0
  52. package/prisma/schema/ongoingEvaluation.prisma +59 -0
  53. package/prisma/schema/organisation.prisma +44 -0
  54. package/prisma/schema/overallFeedback.prisma +35 -0
  55. package/prisma/schema/panelist.prisma +24 -0
  56. package/prisma/schema/permission.prisma +13 -0
  57. package/prisma/schema/questions.prisma +36 -0
  58. package/prisma/schema/resume.prisma +26 -0
  59. package/prisma/schema/resumeData.prisma +15 -0
  60. package/prisma/schema/schema.prisma +16 -0
  61. package/prisma/schema/suggestion.prisma +21 -0
  62. package/prisma/schema/transcript.prisma +26 -0
  63. package/prisma/schema/user.prisma +68 -0
  64. package/prisma/schema/userProfile.prisma +15 -0
@@ -0,0 +1,1158 @@
1
+ model CandidateQuestionResponse {
2
+ id String @id @default(uuid())
3
+ question_id String
4
+ candidate_id String
5
+ assessment_id String
6
+ response String
7
+ score Float?
8
+ created_by String
9
+ updated_by String
10
+ created_at DateTime @default(now())
11
+ updated_at DateTime @updatedAt
12
+ is_active Boolean @default(true)
13
+ // Relations
14
+ question Question @relation(fields: [question_id], references: [id], onDelete: Cascade)
15
+ assessment Assessment @relation(fields: [assessment_id], references: [id], onDelete: Cascade)
16
+ candidate User @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
17
+
18
+ @@index([candidate_id])
19
+ @@index([question_id])
20
+ @@index([assessment_id])
21
+ }
22
+
23
+ model UserRole {
24
+ id String @id @default(uuid())
25
+ role String
26
+ organisation_id String?
27
+ is_custom Boolean @default(false)
28
+ organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
29
+ permission_id String? @unique
30
+ permission Permission? @relation(fields: [permission_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
31
+ users User[]
32
+ created_at DateTime @default(now())
33
+ updated_at DateTime @updatedAt
34
+ created_by String
35
+ updated_by String
36
+ is_active Boolean @default(true)
37
+
38
+ @@unique([role, organisation_id])
39
+ @@index([role, organisation_id])
40
+ @@index([organisation_id])
41
+ @@index([permission_id])
42
+ }
43
+
44
+ enum ActionType {
45
+ TAKE_INTERVIEW
46
+ PROVIDE_FEEDBACK
47
+ SCHEDULE_INTERVIEW
48
+ }
49
+
50
+ enum ActionStatus {
51
+ PENDING
52
+ COMPLETED
53
+ CANCELLED
54
+ }
55
+
56
+ model Action {
57
+ id String @id @default(uuid())
58
+ assignee_id String
59
+ title String
60
+ action_type ActionType
61
+ action_id String // Generic foreign key that can link to any entity
62
+ due_date DateTime?
63
+ organisation_id String
64
+ status ActionStatus @default(PENDING)
65
+ // Relations
66
+ user User @relation(fields: [assignee_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
67
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
68
+ // Audit fields
69
+ created_at DateTime @default(now())
70
+ updated_at DateTime @updatedAt
71
+ created_by String
72
+ updated_by String
73
+ is_active Boolean @default(true)
74
+
75
+ @@index([assignee_id, action_type])
76
+ @@index([status])
77
+ @@index([due_date])
78
+ }
79
+
80
+ // PENDING could be understood as unscreened
81
+ enum ApplicationStatus {
82
+ PENDING
83
+ IN_PROGRESS
84
+ SHORTLISTED
85
+ REJECTED
86
+ }
87
+
88
+ model Application {
89
+ id String @id @default(uuid())
90
+ candidate_id String
91
+ resume_id String
92
+ organisation_id String
93
+ job_description_id String
94
+ status ApplicationStatus @default(PENDING)
95
+ fit_check_score Float?
96
+ fit_check_status FitCheckStatus?
97
+ applied_at DateTime @default(now())
98
+ evaluation_plan_id String?
99
+ evaluation_plan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id])
100
+ fit_check_id String? @unique
101
+ round_no Int @default(0)
102
+
103
+ // Relations
104
+ candidate User @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
105
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
106
+ resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
107
+ job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
108
+ fit_check FitCheck? @relation(fields: [fit_check_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
109
+ interviews Interview[]
110
+ ongoing_evaluations OngoingEvaluation[]
111
+
112
+ created_at DateTime @default(now())
113
+ updated_at DateTime @updatedAt
114
+ created_by String
115
+ updated_by String
116
+ is_active Boolean @default(true)
117
+
118
+ @@unique([candidate_id, job_description_id]) // Ensures candidate applies only once per job
119
+ @@index([candidate_id])
120
+ @@index([job_description_id])
121
+ @@index([organisation_id])
122
+ @@index([resume_id])
123
+ }
124
+
125
+ model Approval {
126
+ id String @id @default(uuid())
127
+ job_description_id String
128
+ user_id String
129
+ organisaton_id String
130
+ created_at DateTime @default(now())
131
+ updated_at DateTime @updatedAt
132
+ created_by String
133
+ updated_by String
134
+ is_active Boolean @default(true)
135
+ job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
136
+ user User @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
137
+ organisation Organisation @relation(fields: [organisaton_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
138
+ }
139
+
140
+ enum AssessmentStatus {
141
+ SCHEDULED // Assessment has been created and scheduled
142
+ IN_PROGRESS // Candidate is currently giving the assessment
143
+ COMPLETED // Assessment completed by candidate
144
+ CANCELLED // Assessment cancelled by admin or system
145
+ RESCHEDULED // Assessment rescheduled to a new time
146
+ NO_SHOW // Candidate failed to take the assessment
147
+ EVALUATION_PENDING // Waiting for manual/AI review of answers
148
+ EVALUATED // Final evaluation completed and locked
149
+ }
150
+
151
+ model Assessment {
152
+ id String @id @default(uuid())
153
+ assessment_id String
154
+ candidate_id String
155
+ reviewer_id String?
156
+ score Float?
157
+ feedback String?
158
+ scheduled_start_time DateTime? @default(now()) // Start Time to start the assessment
159
+ assessment_status AssessmentStatus @default(SCHEDULED)
160
+ created_at DateTime @default(now())
161
+ updated_at DateTime @updatedAt
162
+ created_by String
163
+ updated_by String
164
+ is_active Boolean @default(true)
165
+ // Relations
166
+ assessment_libarary AssessmentLibrary @relation(fields: [assessment_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
167
+ candidate User @relation("CandidateAssessments", fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
168
+ reviewer User? @relation("ReviewerAssessments", fields: [reviewer_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
169
+ questions AssessmentQuestion[] @relation("AssessmentToAssessmentQuestion")
170
+ candidateResponse CandidateQuestionResponse[]
171
+ Panelist Panelist? @relation(fields: [panelistId], references: [id])
172
+ panelistId String?
173
+ User User? @relation(fields: [userId], references: [id])
174
+ userId String?
175
+
176
+ @@unique([assessment_id, candidate_id])
177
+ @@index([assessment_id])
178
+ @@index([candidate_id])
179
+ }
180
+
181
+ /// Defines how an assessment is conducted.
182
+
183
+ enum AssessmentCategory {
184
+ MCQ
185
+ COMPETENCY
186
+ CASE_STUDY
187
+ ASSIGNMENT
188
+ }
189
+
190
+ model AssessmentLibrary {
191
+ id String @id @default(uuid())
192
+ title String
193
+ assessment_type String?
194
+ description String?
195
+ assessment_category AssessmentCategory
196
+ time_required Int
197
+ passing_score Float?
198
+ max_score Float?
199
+ organisation_id String
200
+ created_by_ai Boolean @default(false)
201
+ created_at DateTime @default(now())
202
+ updated_at DateTime @updatedAt
203
+ created_by String
204
+ updated_by String
205
+ is_active Boolean @default(true)
206
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
207
+ questions Question[] // One assessment → many questions
208
+ assessments Assessment[]
209
+ evaluation_Plans EvaluationPlan[]
210
+
211
+ @@index([organisation_id])
212
+ @@index([created_at])
213
+ }
214
+
215
+ /**
216
+ * Join table linking Assessments and Questions in a many-to-many relationship.
217
+ * - Each row represents one link between a specific Assessment and a specific Question.
218
+ * - Composite ID ensures no duplicate pairings exist.
219
+ * - Cascade delete ensures join rows are removed when either side is deleted.
220
+ * - Enables sharing the same Question across multiple Assessments.
221
+ */
222
+ model AssessmentQuestion {
223
+ assessment_id String
224
+ question_id String
225
+ assessment Assessment @relation("AssessmentToAssessmentQuestion", fields: [assessment_id], references: [id], onDelete: Cascade)
226
+ question Question @relation("QuestionToAssessmentQuestion", fields: [question_id], references: [id], onDelete: Cascade)
227
+ created_at DateTime @default(now())
228
+ updated_at DateTime @updatedAt
229
+
230
+ @@id([assessment_id, question_id])
231
+ }
232
+
233
+ model AssignmentLibrary {
234
+ id String @id @default(uuid())
235
+ deadline Int
236
+ /// Flexible JSON for assignment-specific config (rubrics, instructions, criteria, etc.)
237
+ assignment Json?
238
+ job_description_id String
239
+ organisation_id String
240
+ created_at DateTime @default(now())
241
+ updated_at DateTime @updatedAt
242
+ created_by String
243
+ updated_by String
244
+ is_active Boolean @default(true)
245
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
246
+ jobDescription JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
247
+ /// Back-relation: one-to-one from EvaluationPlan (FK lives on EvaluationPlan.assignment_library_id)
248
+ evaluationPlan EvaluationPlan[]
249
+
250
+ @@index([job_description_id])
251
+ @@index([created_at])
252
+ }
253
+
254
+ enum JobType {
255
+ Full_time
256
+ Part_time
257
+ Contract
258
+ Internship
259
+ Temporary
260
+ }
261
+
262
+ enum JDCreationType {
263
+ Pick_from_Library
264
+ Upload_JD
265
+ Create_New
266
+ Create_From_Profile
267
+ }
268
+
269
+ model Budget {
270
+ id String @id @default(uuid())
271
+ job_type JobType
272
+ location String
273
+ shift String
274
+ openings Int
275
+ budget_per_job String
276
+ level String
277
+ start_date DateTime
278
+ closing_date DateTime
279
+ business_unit String
280
+ purpose String
281
+ role String
282
+ domain String
283
+ jd_creation_type JDCreationType
284
+ job_description_id String @unique
285
+ job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
286
+ created_at DateTime @default(now())
287
+ updated_at DateTime @updatedAt
288
+ created_by String
289
+ updated_by String
290
+ is_active Boolean @default(true)
291
+ }
292
+
293
+ model Calendly {
294
+ id String @id @default(uuid())
295
+ user_id String @unique
296
+
297
+ access_token String
298
+ refresh_token String
299
+ expires_at DateTime
300
+ calendly_user_uri String
301
+ scope String?
302
+
303
+ user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
304
+
305
+ created_at DateTime @default(now())
306
+ updated_at DateTime @updatedAt
307
+ created_by String
308
+ updated_by String
309
+ is_active Boolean @default(true)
310
+ }
311
+
312
+ model CandidateProfile {
313
+ id String @id @default(uuid())
314
+ created_at DateTime @default(now())
315
+ updated_at DateTime @updatedAt
316
+ name String
317
+ phone String
318
+ location String
319
+ salary String?
320
+ description String?
321
+ resume_id String? @unique
322
+ date_of_birth DateTime?
323
+
324
+ user User? @relation(fields: [user_id], references: [id])
325
+ user_id String? @unique
326
+
327
+ resume Resume? @relation(fields: [resume_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
328
+
329
+ work_experience Json?
330
+ education Json?
331
+ notice_period String?
332
+ gender String?
333
+ ethnicity String?
334
+ veteran_status String?
335
+ disability_status String?
336
+ is_active Boolean @default(true)
337
+ }
338
+
339
+ model ContactUs {
340
+ id String @id @default(uuid())
341
+ name String
342
+ email String
343
+ organisation_name String
344
+ organisation_website String
345
+ subject String
346
+ message String
347
+ createdAt DateTime @default(now())
348
+ updatedAt DateTime @updatedAt
349
+ is_active Boolean @default(true)
350
+ }
351
+
352
+ enum RoundType {
353
+ ASSESSMENT
354
+ INTERVIEW
355
+ ASSIGNMENT
356
+ SCREENING
357
+ }
358
+
359
+ // Old
360
+ enum WeightageLevel {
361
+ LOW
362
+ MEDIUM
363
+ HIGH
364
+ }
365
+
366
+ enum EvaluationRoundFormat {
367
+ // ────────────────
368
+ // Screening formats
369
+ // ────────────────
370
+ PHONE_CALL
371
+ VIDEO_CALL_AI_ASSISTED
372
+ VIDEO_CALL_UNASSISTED
373
+
374
+ // ────────────────
375
+ // Assessment formats
376
+ // ────────────────
377
+ AI_GENERATED_TEST
378
+ UPLOADED_TEST
379
+ EXTERNAL_PLATFORM
380
+
381
+ // ────────────────
382
+ // Assignment formats
383
+ // ────────────────
384
+ AI_GENERATED_ASSIGNMENT
385
+ UPLOADED_ASSIGNMENT
386
+
387
+ // ────────────────
388
+ // Interview formats
389
+ // ────────────────
390
+ TREADSPACE_AI_ASSISTED
391
+ EXTERNAL_VIDEO_AI_ASSISTED
392
+ EXTERNAL_VIDEO_UNASSISTED
393
+ }
394
+
395
+ enum EvaluationType {
396
+ // Old
397
+ HUMAN_AI // Combination of human and AI evaluation
398
+ AI // Fully automated AI evaluation
399
+ HUMAN // Fully human-driven evaluation
400
+ // New (In active use now)
401
+ TREADSPACE_AI_ASSISTED
402
+ EXTERNAL_AI_ASSISTED
403
+ NON_AI_ASSISTED
404
+ }
405
+
406
+ model EvaluationPlan {
407
+ id String @id @default(uuid())
408
+ job_description_id String
409
+ assessment_id String?
410
+ assignment_library_id String?
411
+ title String
412
+ description String?
413
+ format EvaluationRoundFormat?
414
+ weightage WeightageLevel?
415
+ topics String[]
416
+ assignee String?
417
+ elimination_round Boolean @default(false)
418
+ evaluation_type EvaluationType
419
+ type_of_round RoundType
420
+ timeline Int
421
+ order_no Int
422
+ details Json?
423
+ lock_weight Boolean?
424
+ created_by String
425
+ updated_by String
426
+ created_at DateTime @default(now())
427
+ updated_at DateTime @updatedAt
428
+ is_active Boolean @default(true)
429
+ // Relations
430
+ jobDescription JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade)
431
+ questions Question[] // One evaluation plan → many questions
432
+ panelists Panelist[]
433
+ interviews Interview[]
434
+ applications Application[]
435
+ // 👇 New optional one-to-one relation with AssessmentLibrary
436
+ assessment AssessmentLibrary? @relation(fields: [assessment_id], references: [id], onDelete: SetNull)
437
+ assignment_library AssignmentLibrary? @relation(fields: [assignment_library_id], references: [id], onDelete: SetNull)
438
+ ongoing_evaluations OngoingEvaluation[]
439
+
440
+ @@unique([job_description_id, order_no])
441
+ @@index([job_description_id])
442
+ }
443
+
444
+ model Feedback {
445
+ id String @id @default(uuid())
446
+ interview_id String
447
+ order_no Int
448
+
449
+ ai_feedback Json?
450
+ human_feedback Json?
451
+
452
+ created_at DateTime @default(now())
453
+ updated_at DateTime @updatedAt
454
+ created_by String
455
+ updated_by String
456
+ is_active Boolean @default(true)
457
+ interview Interview @relation(fields: [interview_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
458
+
459
+ @@unique([interview_id, order_no])
460
+ @@index([interview_id])
461
+ }
462
+
463
+ enum FitCheckStatus {
464
+ RECOMMENDED
465
+ TO_REVIEW
466
+ NOT_RECOMMENDED
467
+ }
468
+
469
+ model FitCheck {
470
+ /// Primary key (UUID)
471
+ id String @id @default(uuid())
472
+ /// FK to organisations table
473
+ organisation_id String?
474
+ resume_id String
475
+ job_description_id String
476
+
477
+ /// Old Fields will be deprecated soon
478
+ skills_match String[]
479
+ skills_score Float?
480
+ responsibilities_match String[]
481
+ responsibilities_score Float?
482
+ experience_match String[]
483
+ experience_score Float?
484
+ organisation_value_score Float?
485
+ organisation_value_match String[]
486
+ qualifications_match String[]
487
+ qualifications_score Float?
488
+ overall_analysis String[]
489
+ fit Json[]
490
+ fit_check_status FitCheckStatus?
491
+ // Fields to be used now
492
+
493
+ overall_score Float
494
+ short_match_analysis Json[]
495
+ candidate_analysis Json[]
496
+ technical_analysis Json[]
497
+ competency_analysis Json[]
498
+ recommendation Json?
499
+
500
+ /// Audit fields
501
+ created_by String
502
+ updated_by String
503
+ is_active Boolean @default(true)
504
+ /// Timestamps
505
+ created_at DateTime @default(now())
506
+ updated_at DateTime @updatedAt
507
+ /// Relations
508
+ organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
509
+ resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
510
+ job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
511
+ application Application?
512
+
513
+ /// Ensure one FitCheck per (resume_id, job_description_id) pair
514
+ @@unique([resume_id, job_description_id])
515
+ @@index([resume_id])
516
+ }
517
+
518
+ model Google {
519
+ id String @id @default(uuid())
520
+ user_id String @unique
521
+
522
+ google_email String
523
+ refresh_token String
524
+ scope String?
525
+
526
+ user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
527
+
528
+ created_at DateTime @default(now())
529
+ updated_at DateTime @updatedAt
530
+ created_by String
531
+ updated_by String
532
+ is_active Boolean @default(true)
533
+ }
534
+
535
+ model IntermediateFeedback {
536
+ id String @id @default(uuid())
537
+ interview_id String
538
+ overall_feedback_id String?
539
+ intermediate_feedback Json
540
+ order_no Int @default(autoincrement())
541
+ created_at DateTime @default(now())
542
+ updated_at DateTime @updatedAt
543
+ created_by String
544
+ updated_by String
545
+ is_active Boolean @default(true)
546
+ // Relations
547
+ interview Interview @relation(fields: [interview_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
548
+ OverallFeedback OverallFeedback? @relation(fields: [overall_feedback_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
549
+ transcripts Transcript[]
550
+
551
+ @@index([interview_id])
552
+ }
553
+
554
+ enum InterviewStatus {
555
+ INTERVIEW_REQUESTED
556
+ SCHEDULED
557
+ IN_PROGRESS
558
+ CANCELLED
559
+ NO_SHOW // Candidate or interviewer failed to appear
560
+ EVALUATION_PENDING // Waiting for feedback or evaluation
561
+ EVALUATED // Feedback completed and locked
562
+ }
563
+
564
+ enum InterviewFeedback {
565
+ STRONG_HIRE
566
+ HIRE
567
+ NO_HIRE
568
+ STRONG_NO_HIRE
569
+ }
570
+
571
+ model Interview {
572
+ id String @id @default(uuid())
573
+ candidate_id String
574
+ interviewer_id String?
575
+ evaluation_plan_id String
576
+ application_id String?
577
+ resume_id String
578
+ job_description_id String
579
+ organisation_id String
580
+ room_name String?
581
+ interview_summary String[]
582
+ ai_interview_feedback InterviewFeedback?
583
+ interview_feedback InterviewFeedback?
584
+ interview_rating Float? // Overall rating out of 100 based on evaluation
585
+ scheduled_start_time DateTime?
586
+ scheduled_end_time DateTime?
587
+ actual_start_time DateTime?
588
+ actual_end_time DateTime?
589
+ recording_url String?
590
+ interview_status InterviewStatus @default(SCHEDULED)
591
+ google_event_id String?
592
+ created_at DateTime @default(now())
593
+ updated_at DateTime @updatedAt
594
+ created_by String
595
+ updated_by String
596
+ is_active Boolean @default(true)
597
+ // Relations
598
+ candidate User? @relation("CandidateInterviews", fields: [candidate_id], references: [id], onDelete: SetNull)
599
+ interviewer User? @relation("InterviewerInterviews", fields: [interviewer_id], references: [id], onDelete: SetNull)
600
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
601
+ job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
602
+ resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
603
+ evaluation_plan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
604
+ application Application? @relation(fields: [application_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
605
+ ongoing_evaluation OngoingEvaluation?
606
+ intermediateFeedbacks IntermediateFeedback[]
607
+ transcripts Transcript[]
608
+ suggestions Suggestion[]
609
+ overallFeedback OverallFeedback[]
610
+ feedback Feedback[]
611
+ interviewNotes InterviewNotes[]
612
+
613
+ @@unique([interviewer_id, candidate_id, evaluation_plan_id])
614
+ @@index([application_id])
615
+ @@index([candidate_id])
616
+ @@index([interviewer_id])
617
+ @@index([job_description_id])
618
+ }
619
+
620
+ /// Defines the category or purpose of the interview, suitable for any job role.
621
+ enum InterviewCategory {
622
+ SCREENING // Initial screening interview
623
+ TECHNICAL // Skill or role-specific interview
624
+ BEHAVIORAL // Behavioral or situational round
625
+ CASE_STUDY // Case-based or analytical round
626
+ MANAGERIAL // Leadership or management-focused
627
+ CULTURAL_FIT // Checks alignment with company culture
628
+ FINAL_DISCUSSION // Final HR or offer discussion
629
+ GENERAL // Generic or flexible-purpose interview
630
+ }
631
+
632
+ /// Represents a reusable interview template applicable to any job type.
633
+ model InterviewLibrary {
634
+ id String @id @default(uuid())
635
+ title String
636
+ description String
637
+ organisation_id String
638
+ category InterviewCategory
639
+ evaluation_type EvaluationType
640
+ duration Float
641
+ passing_marks Float
642
+ is_active Boolean @default(true)
643
+ created_by String
644
+ updated_by String
645
+ created_at DateTime @default(now())
646
+ updated_at DateTime @updatedAt
647
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
648
+
649
+ @@index([organisation_id])
650
+ @@index([category])
651
+ @@index([created_at])
652
+ }
653
+
654
+ model InterviewNotes {
655
+ id String @id @default(uuid())
656
+ interview_id String
657
+ note String
658
+ details Json?
659
+ timestamp DateTime @default(now())
660
+ created_at DateTime @default(now())
661
+ updated_at DateTime @updatedAt
662
+ created_by String
663
+ updated_by String
664
+ is_active Boolean @default(true)
665
+
666
+ // Relations
667
+ interview Interview @relation(fields: [interview_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
668
+
669
+ @@index([interview_id])
670
+ }
671
+
672
+ enum JobDescriptionStatus {
673
+ CREATED
674
+ DRAFT
675
+ ACTIVE
676
+ DEACTIVATED
677
+ CLOSED
678
+ }
679
+
680
+ model JobDescription {
681
+ id String @id @default(uuid())
682
+ hiring_manager_id String?
683
+ status JobDescriptionStatus @default(DRAFT)
684
+ organisation_id String
685
+ screeningQuestions String[]
686
+ recommendedQuestions Json[]
687
+ created_at DateTime @default(now())
688
+ updated_at DateTime @updatedAt
689
+ created_by String
690
+ updated_by String
691
+ uploaded_job_description_path String?
692
+ is_active Boolean @default(true)
693
+ is_plan_locked Boolean @default(false)
694
+ is_posted Boolean @default(false)
695
+ openings Int @default(1)
696
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
697
+ ai_insight Json?
698
+ applications Application[]
699
+ interviews Interview[]
700
+ fit_check FitCheck[] // one-to-many link
701
+ job_description_data JobDescriptionData[] // one-to-many link
702
+ evaluationPlan EvaluationPlan[] // relation to evaluation methods
703
+ ongoing_evaluations OngoingEvaluation[] // optional one-to-many
704
+ assignment_library AssignmentLibrary[]
705
+ approvals Approval[] // one-to-many relation
706
+ resumes Resume[] // one-to-many link
707
+ budget Budget?
708
+ hiring_manager User? @relation("HiringManager", fields: [hiring_manager_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
709
+ recruiters User[]
710
+ transcripts Transcript[]
711
+
712
+ @@index([organisation_id])
713
+ @@index([hiring_manager_id])
714
+ }
715
+
716
+ model JobDescriptionData {
717
+ id String @id @default(uuid())
718
+ job_description_id String
719
+ key String
720
+ value String
721
+ created_at DateTime @default(now())
722
+ updated_at DateTime @updatedAt
723
+ created_by String
724
+ updated_by String
725
+ is_active Boolean @default(true)
726
+
727
+ jobDescription JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
728
+
729
+ @@unique([job_description_id, key])
730
+ @@index([created_at])
731
+ }
732
+
733
+ model Message {
734
+ id String @id @default(uuid())
735
+ sender_id String
736
+ receiver_id String
737
+ message String
738
+
739
+ sender User @relation("Sent Messages", fields: [sender_id], references: [id])
740
+ receiver User @relation("Received Messages", fields: [receiver_id], references: [id])
741
+
742
+ created_at DateTime @default(now())
743
+ updated_at DateTime @updatedAt
744
+ created_by String
745
+ updated_by String
746
+ is_active Boolean @default(true)
747
+ }
748
+
749
+ enum OngoingEvaluationStatus {
750
+ LOCKED
751
+ ACTION_REQUIRED
752
+ IN_PROGRESS
753
+ EVALUATED
754
+ CLEARED
755
+ NOT_CLEARED
756
+ SKIPPED
757
+ }
758
+
759
+ enum OngoingEvaluationState {
760
+ NOT_STARTED
761
+ IN_PROGRESS
762
+ CLEARED
763
+ SKIPPED
764
+ NOT_CLEARED
765
+ }
766
+
767
+ enum OngoingEvaluationRoundStatus {
768
+ NOT_SCHEDULED
769
+ REQUESTED_SCHEDULING
770
+ SCHEDULED
771
+ IN_PROGRESS
772
+ PENDING_EVALUATION
773
+ EVALUATED
774
+ }
775
+
776
+ model OngoingEvaluation {
777
+ id String @id @default(uuid())
778
+ application_id String
779
+ candidate_id String
780
+ resume_id String
781
+ organisation_id String
782
+ job_description_id String
783
+ evaluation_plan_id String
784
+ interview_id String? @unique
785
+ status OngoingEvaluationStatus?
786
+ state OngoingEvaluationState? @default(NOT_STARTED)
787
+ round_status OngoingEvaluationRoundStatus? @default(NOT_SCHEDULED)
788
+ comments String? @default("")
789
+ // Relations
790
+ jobDescription JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull)
791
+ application Application @relation(fields: [application_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
792
+ candidate User? @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
793
+ resume Resume? @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
794
+ organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
795
+ evaluation_plan EvaluationPlan @relation(fields: [evaluation_plan_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
796
+ interview Interview? @relation(fields: [interview_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
797
+ created_at DateTime @default(now())
798
+ updated_at DateTime @updatedAt
799
+ created_by String
800
+ updated_by String
801
+ is_active Boolean @default(true)
802
+ is_current Boolean @default(false)
803
+
804
+ @@unique([application_id, evaluation_plan_id])
805
+ @@index([application_id])
806
+ @@index([evaluation_plan_id])
807
+ }
808
+
809
+ enum OrganisationSize {
810
+ ONE_TO_TEN @map("1-10")
811
+ ELEVEN_TO_FIFTY @map("11-50")
812
+ FIFTY_ONE_TO_TWO_HUNDRED @map("51-200")
813
+ TWO_HUNDRED_ONE_TO_FIVE_HUNDRED @map("201-500")
814
+ FIVE_HUNDRED_PLUS @map("500+")
815
+ }
816
+
817
+ model Organisation {
818
+ id String @id @default(uuid())
819
+ name String @unique
820
+ industry String
821
+ about String
822
+ website String
823
+ size OrganisationSize @default(ONE_TO_TEN)
824
+ phone String
825
+ address String
826
+ company_values Json[]
827
+
828
+ interviewers User[]
829
+ created_at DateTime @default(now())
830
+ updated_at DateTime @updatedAt
831
+ created_by String
832
+ updated_by String
833
+ is_active Boolean @default(true)
834
+ alias String? @unique
835
+ logo String?
836
+ applications Application[]
837
+ user_roles UserRole[]
838
+ job_descriptions JobDescription[]
839
+ assessment_library AssessmentLibrary[]
840
+ assignment_library AssignmentLibrary[]
841
+ interview_library InterviewLibrary[]
842
+ interviews Interview[]
843
+ fit_check FitCheck[] // one-to-many link
844
+ resumes Resume[] // one-to-many link
845
+ panelists Panelist[] // one-to-many link
846
+ approvals Approval[] // one-to-many link
847
+ suggestions Suggestion[]
848
+ ongoing_evaluations OngoingEvaluation[] // optional one-to-many
849
+ actions Action[]
850
+
851
+ @@index([name])
852
+ }
853
+
854
+ enum FeedbackType {
855
+ HUMAN
856
+ AI
857
+ }
858
+
859
+ enum OverallRecommendation {
860
+ StrongHire
861
+ Hire
862
+ LeaningHire
863
+ NoHire
864
+ StrongNoHire
865
+ }
866
+
867
+ model OverallFeedback {
868
+ id String @id @default(uuid())
869
+ interview_id String
870
+ interviewer_id String? // 👈 optional field
871
+ feedback_type FeedbackType
872
+ overall_score Float
873
+ overall_recommendation OverallRecommendation
874
+ overall_feedback Json
875
+ created_at DateTime @default(now())
876
+ updated_at DateTime @updatedAt
877
+ created_by String
878
+ updated_by String
879
+ is_active Boolean @default(true)
880
+ // Relations
881
+ interview Interview @relation(fields: [interview_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
882
+ interviewer Panelist? @relation(fields: [interviewer_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
883
+ intermediateFeedbacks IntermediateFeedback[] // 👈 one-to-many relation added here
884
+
885
+ @@unique([interview_id, interviewer_id]) // 👈 updated uniqueness logic
886
+ @@index([interview_id])
887
+ @@index([interviewer_id])
888
+ }
889
+
890
+ model Panelist {
891
+ id String @id @default(uuid())
892
+ name String
893
+ designation String
894
+ experience String // e.g. "10+", keeping as String for flexibility
895
+ expertise String // e.g. "Product Strategy, Figma..."
896
+ suited_interview String // e.g. "Consulting, Customer understanding..."
897
+ industry String // e.g. "Healthcare, Fintech"
898
+ special_areas String? // Optional field
899
+ organisation_id String
900
+ user_id String @unique
901
+
902
+ user User @relation(fields: [user_id], references: [id])
903
+ organisation Organisation @relation(fields: [organisation_id], references: [id])
904
+ evaluationPlans EvaluationPlan[]
905
+ overallFeedbacks OverallFeedback[]
906
+ created_at DateTime @default(now())
907
+ updated_at DateTime @updatedAt
908
+ created_by String
909
+ updated_by String
910
+ is_active Boolean @default(true)
911
+
912
+ assessments Assessment[]
913
+ }
914
+
915
+ model Permission {
916
+ id String @id @default(uuid())
917
+ permissions String[] @default([])
918
+ created_by String?
919
+ updated_by String?
920
+ updated_at DateTime @updatedAt
921
+ created_at DateTime @default(now())
922
+ is_active Boolean @default(true)
923
+ user User?
924
+ user_roles UserRole?
925
+
926
+ @@index([created_at])
927
+ }
928
+
929
+ enum Difficulty {
930
+ EASY // simple/basic questions
931
+ MEDIUM // moderate difficulty
932
+ HARD // challenging questions
933
+ }
934
+
935
+ enum QuestionType {
936
+ MCQ
937
+ TRUE_FALSE
938
+ THEORY
939
+ CODING
940
+ }
941
+
942
+ model Question {
943
+ id String @id @default(uuid())
944
+ assessment_library_id String?
945
+ evaluation_plan_id String?
946
+ candidate_id String?
947
+ skill String?
948
+ question_type QuestionType?
949
+ question String
950
+ answer String
951
+ options String[] // For MCQ's
952
+ max_score Float?
953
+ difficulty Difficulty?
954
+ created_by String
955
+ updated_by String
956
+ created_at DateTime @default(now())
957
+ updated_at DateTime @updatedAt
958
+ is_active Boolean @default(true)
959
+ candidate User? @relation(fields: [candidate_id], references: [id], onDelete: SetNull)
960
+ assessments AssessmentQuestion[] @relation("QuestionToAssessmentQuestion")
961
+ assessmentLibrary AssessmentLibrary? @relation(fields: [assessment_library_id], references: [id], onDelete: Cascade)
962
+ evaluationPlan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id], onDelete: SetNull)
963
+ candidateResponse CandidateQuestionResponse[]
964
+ }
965
+
966
+ model Resume {
967
+ id String @id @default(uuid())
968
+ user_id String?
969
+ organisation_id String?
970
+ job_description_id String?
971
+ uploaded_resume_path String?
972
+ created_at DateTime @default(now())
973
+ updated_at DateTime @updatedAt
974
+ created_by String
975
+ updated_by String
976
+ is_active Boolean @default(true)
977
+ user User? @relation(fields: [user_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
978
+ organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
979
+ job_description JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
980
+ applications Application[]
981
+ interviews Interview[]
982
+ ongoing_evaluations OngoingEvaluation[] // optional one-to-many
983
+
984
+ resume_data ResumeData[] // one-to-many link
985
+ fit_check FitCheck[] // one-to-many link
986
+ // inverse side of the relation — no foreign key here
987
+ candidate_profile CandidateProfile? // one-to-one link
988
+ yearsOfExperience Int?
989
+
990
+ @@index([user_id])
991
+ }
992
+
993
+ model ResumeData {
994
+ id String @id @default(uuid())
995
+ resume_id String
996
+ key String
997
+ value String
998
+ created_at DateTime @default(now())
999
+ updated_at DateTime @updatedAt
1000
+ created_by String
1001
+ updated_by String
1002
+ is_active Boolean @default(true)
1003
+
1004
+ resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1005
+
1006
+ @@index([created_at])
1007
+ }
1008
+
1009
+ // This is your Prisma schema file,
1010
+ // learn more about it in the docs: https://pris.ly/d/prisma-schema
1011
+
1012
+ // Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
1013
+ // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
1014
+
1015
+ generator client {
1016
+ provider = "prisma-client-js"
1017
+ output = "../../client"
1018
+ binaryTargets = ["native", "linux-arm64-openssl-1.1.x"]
1019
+ }
1020
+
1021
+ datasource db {
1022
+ provider = "postgresql"
1023
+ url = env("DATABASE_URL")
1024
+ }
1025
+
1026
+ model Suggestion {
1027
+ id String @id @default(uuid())
1028
+ interview_id String?
1029
+ transcript_id String? @unique // ✅ ensures one-to-one
1030
+ organisation_id String
1031
+ suggestion String
1032
+ question String?
1033
+ created_at DateTime @default(now())
1034
+ updated_at DateTime @updatedAt
1035
+ created_by String
1036
+ updated_by String
1037
+ is_active Boolean @default(true)
1038
+
1039
+ // Relations
1040
+ interview Interview? @relation(fields: [interview_id], references: [id], onDelete: SetNull)
1041
+ transcripts Transcript[]
1042
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade)
1043
+
1044
+ @@index([interview_id])
1045
+ @@index([transcript_id])
1046
+ }
1047
+
1048
+ model Transcript {
1049
+ id String @id @default(uuid())
1050
+ interview_id String?
1051
+ suggestion_id String?
1052
+ intermediate_feedback_id String?
1053
+ job_description_id String?
1054
+ interviewer_timestamp DateTime?
1055
+ candidate_timestamp DateTime?
1056
+ interviewer String
1057
+ candidate String
1058
+ order_no Int @default(autoincrement())
1059
+ created_at DateTime @default(now())
1060
+ updated_at DateTime @updatedAt
1061
+ created_by String
1062
+ updated_by String
1063
+ is_active Boolean @default(true)
1064
+ // Relations
1065
+ interview Interview? @relation(fields: [interview_id], references: [id], onDelete: SetNull, onUpdate: SetNull)
1066
+ suggestion Suggestion? @relation(fields: [suggestion_id], references: [id], onDelete: SetNull)
1067
+ intermediate_feedback IntermediateFeedback? @relation(fields: [intermediate_feedback_id], references: [id], onDelete: SetNull)
1068
+ job_description JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1069
+
1070
+ @@unique([interview_id, order_no])
1071
+ @@index([interview_id])
1072
+ @@index([job_description_id])
1073
+ }
1074
+
1075
+ enum FirstLoginStatus {
1076
+ PENDING
1077
+ COMPLETED
1078
+ }
1079
+
1080
+ model User {
1081
+ id String @id @default(uuid())
1082
+ email String @unique
1083
+ password String
1084
+ role_id String
1085
+ role UserRole @relation(fields: [role_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
1086
+ // Back-relations are defined from Resume side via user_id
1087
+ google_id String? @unique
1088
+ refresh_token String?
1089
+ created_at DateTime @default(now())
1090
+ updated_at DateTime @updatedAt
1091
+ created_by String
1092
+ updated_by String
1093
+ is_active Boolean @default(true)
1094
+ is_self_registered Boolean @default(true)
1095
+ permission_id String? @unique
1096
+ permission Permission? @relation(fields: [permission_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1097
+ organisation_id String?
1098
+ organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1099
+ applications Application[]
1100
+ resume Resume[]
1101
+ candidate_profile CandidateProfile?
1102
+ user_profile UserProfile?
1103
+ job_description JobDescription[]
1104
+ hiring_manager_job_descriptions JobDescription[] @relation("HiringManager")
1105
+ approvals Approval[]
1106
+ panelist Panelist?
1107
+ sent_messages Message[] @relation("Sent Messages")
1108
+ received_messages Message[] @relation("Received Messages")
1109
+ profile_created Boolean
1110
+ first_login_status FirstLoginStatus @default(PENDING)
1111
+ // Back-relations for interviews (optional but recommended for clarity)
1112
+ candidate_interviews Interview[] @relation("CandidateInterviews")
1113
+ interviewer_interviews Interview[] @relation("InterviewerInterviews")
1114
+ assessment_results Assessment[]
1115
+ candidate_assessments Assessment[] @relation("CandidateAssessments")
1116
+ reviewer_assessments Assessment[] @relation("ReviewerAssessments")
1117
+ candidateResponses CandidateQuestionResponse[]
1118
+ questions Question[]
1119
+ ongoing_evaluations OngoingEvaluation[] // optional one-to-many
1120
+ actions Action[]
1121
+ calendly Calendly?
1122
+ google Google?
1123
+
1124
+ name String?
1125
+ phone String?
1126
+ description String?
1127
+ date_of_birth DateTime?
1128
+ designation String?
1129
+ location String?
1130
+ salary String?
1131
+ work_experience Json?
1132
+ education Json?
1133
+ notice_period String?
1134
+ gender String?
1135
+ ethnicity String?
1136
+ veteran_status String?
1137
+ disability_status String?
1138
+
1139
+ @@index([role_id])
1140
+ @@index([permission_id])
1141
+ @@index([organisation_id])
1142
+ }
1143
+
1144
+ model UserProfile {
1145
+ id String @id @default(uuid())
1146
+ created_at DateTime @default(now())
1147
+ updated_at DateTime @updatedAt
1148
+ name String
1149
+ phone String
1150
+ description String
1151
+ date_of_birth String
1152
+ designation String
1153
+ is_active Boolean @default(true)
1154
+ user User? @relation(fields: [user_id], references: [id])
1155
+ user_id String? @unique
1156
+
1157
+ work_experience Json?
1158
+ }