@adaptware/eagles-db 0.4.13 → 0.4.17

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "prisma-client-3057ec88b47cc8f33a5e1c389c17b6a3cf353971bcd9ca2cc7d4354787f280f1",
2
+ "name": "prisma-client-191b7e23829fd0fb9f0cd21a69a06794a22ae57f9d2bfbd84a0b335e373fb7bc",
3
3
  "main": "index.js",
4
4
  "types": "index.d.ts",
5
5
  "browser": "index-browser.js",
@@ -80,108 +80,6 @@ model Action {
80
80
  @@index([due_date])
81
81
  }
82
82
 
83
- enum ActivityEventType {
84
- APPLICATION_CREATED
85
- APPLICATION_STARTED
86
- APPLICATION_REJECTED
87
- APPLICATION_SHORTLISTED
88
-
89
- ROUND_ASSIGNED
90
- ROUND_STARTED
91
- ROUND_COMPLETED
92
- ROUND_PASSED
93
- ROUND_FAILED
94
- ROUND_SKIPPED
95
-
96
- INTERVIEW_SCHEDULED
97
- INTERVIEW_RESCHEDULED
98
- INTERVIEW_CANCELLED
99
- INTERVIEW_COMPLETED
100
- INTERVIEW_NO_SHOW
101
- INTERVIEW_EVALUATION_PENDING
102
- INTERVIEW_EVALUATED
103
-
104
- FEEDBACK_SUBMITTED
105
-
106
- JOB_CREATED
107
- JOB_PUBLISHED
108
- JOB_CLOSED
109
- JOB_DEACTIVATED
110
-
111
- EVALUATION_PLAN_CREATED
112
- EVALUATION_PLAN_PUBLISHED
113
- EVALUATION_PLAN_DELETED
114
- EVALUATION_PLAN_UPDATED
115
- STATUS_CHANGED
116
-
117
- CUSTOM
118
- }
119
-
120
- enum ActivityEntityType {
121
- APPLICATION
122
-
123
- CANDIDATE
124
-
125
- JOB
126
-
127
- ONGOING_EVALUATION
128
-
129
- EVALUATION_PLAN
130
-
131
- INTERVIEW
132
-
133
- ASSESSMENT
134
-
135
- ORGANISATION
136
-
137
- USER
138
- }
139
-
140
- enum ActivityEntityActorType {
141
- USER
142
-
143
- SYSTEM
144
-
145
- AI_AGENT
146
-
147
- WEBHOOK
148
- }
149
-
150
- model ActivityEvent {
151
- id String @id @default(uuid())
152
-
153
- organisation_id String?
154
-
155
- event_type ActivityEventType
156
-
157
- entity_type ActivityEntityType
158
- entity_id String
159
-
160
- actor_id String?
161
- actor_type ActivityEntityActorType
162
-
163
- related_entities Json?
164
-
165
- snapshot Json?
166
-
167
- payload Json?
168
-
169
- schema_version Int @default(1)
170
-
171
- occurred_at DateTime
172
-
173
- created_at DateTime @default(now())
174
-
175
- organisation Organisation? @relation(fields: [organisation_id], references: [id])
176
-
177
- @@index([organisation_id, occurred_at])
178
- @@index([organisation_id, event_type])
179
- @@index([entity_type, entity_id])
180
- @@index([actor_id])
181
- @@index([occurred_at])
182
- @@map("activity_events")
183
- }
184
-
185
83
  enum ActivityActorType {
186
84
  USER
187
85
  AI
@@ -214,45 +112,45 @@ enum ApplicationStatus {
214
112
  }
215
113
 
216
114
  model Application {
217
- id String @id @default(uuid())
218
- candidate_id String
219
- resume_id String
220
- organisation_id String
221
- job_description_id String
222
- fit_check_score Float?
223
- applied_at DateTime @default(now())
224
- evaluation_plan_id String?
225
- fit_check_id String? @unique
226
- recruiter_id String?
227
- round_no Int @default(0)
115
+ id String @id @default(uuid())
116
+ candidate_id String
117
+ resume_id String
118
+ organisation_id String
119
+ job_description_id String
120
+ fit_check_score Float?
121
+ applied_at DateTime @default(now())
122
+ evaluation_plan_id String?
123
+ fit_check_id String? @unique
124
+ round_no Int @default(0)
228
125
  //Screening fields
229
- on_notice_period Boolean @default(false)
230
- expected_joining_date DateTime?
231
- current_ctc String?
232
- expected_ctc String?
233
- notice_period Int?
234
- preferred_location String?
126
+ on_notice_period Boolean @default(false)
127
+ expected_joining_date DateTime?
128
+ current_ctc String?
129
+ expected_ctc String?
130
+ notice_period Int?
131
+ preferred_location String?
235
132
  // Relations
236
- fit_check_status FitCheckStatus?
237
- status ApplicationStatus @default(PENDING)
238
- evaluation_plan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id])
239
- candidate User @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
240
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
241
- resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
242
- job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
243
- fit_check FitCheck? @relation(fields: [fit_check_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
244
- recruiter User? @relation("ApplicationRecruiter", fields: [recruiter_id], references: [id])
245
- interviews Interview[]
246
- assignments Assignment[]
247
- ongoing_evaluations OngoingEvaluation[]
248
- activity_logs ActivityLog[]
249
- notes Notes[]
133
+ fit_check_status FitCheckStatus?
134
+ status ApplicationStatus @default(PENDING)
135
+ evaluation_plan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id])
136
+ candidate User @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
137
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
138
+ resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
139
+ job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
140
+ fit_check FitCheck? @relation(fields: [fit_check_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
141
+ interviews Interview[]
142
+ assignments Assignment[]
143
+ ongoing_evaluations OngoingEvaluation[]
144
+ activity_logs ActivityLog[]
145
+ notes Notes[]
146
+ conversations Conversation[]
147
+ communication_messages CommunicationMessage[]
250
148
  // Audit fields
251
- created_at DateTime @default(now())
252
- updated_at DateTime @updatedAt
253
- created_by String
254
- updated_by String
255
- is_active Boolean @default(true)
149
+ created_at DateTime @default(now())
150
+ updated_at DateTime @updatedAt
151
+ created_by String
152
+ updated_by String
153
+ is_active Boolean @default(true)
256
154
 
257
155
  @@unique([candidate_id, job_description_id]) // Ensures candidate applies only once per job
258
156
  @@index([candidate_id])
@@ -540,6 +438,163 @@ model CandidateProfile {
540
438
  is_active Boolean @default(true)
541
439
  }
542
440
 
441
+ // Multi-channel communication (WhatsApp, Email, SMS, Call) with provider abstraction.
442
+ // Strategy: typed columns for everything stable; JSON only for genuinely variable data.
443
+
444
+ enum CommChannel {
445
+ WHATSAPP
446
+ EMAIL
447
+ SMS
448
+ CALL
449
+ }
450
+
451
+ enum CommProvider {
452
+ META_WHATSAPP
453
+ TWILIO
454
+ GUPSHUP
455
+ MTALKZ
456
+ THREE_SIXTY_DIALOG
457
+ GMAIL
458
+ OUTLOOK
459
+ GENERIC_SMTP
460
+ GENERIC
461
+ }
462
+
463
+ enum CommDirection {
464
+ INBOUND
465
+ OUTBOUND
466
+ }
467
+
468
+ enum CommMessageStatus {
469
+ QUEUED
470
+ SENT
471
+ DELIVERED
472
+ READ
473
+ FAILED
474
+ RECEIVED
475
+ }
476
+
477
+ /// Per-organisation provider selection + (encrypted) credentials for one channel.
478
+ /// `metadata` stores non-secret provider settings (e.g. phone_number_id, waba_id, webhook_verify_token).
479
+ model ChannelProviderConfig {
480
+ id String @id @default(uuid())
481
+ organisation_id String
482
+ channel CommChannel
483
+ provider CommProvider
484
+ /// Encrypted JSON blob of secrets (token, app_secret, …) using integrationTokenCrypto.
485
+ credentials String?
486
+ metadata Json @default("{}")
487
+ is_active Boolean @default(true)
488
+ is_default Boolean @default(true)
489
+
490
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade)
491
+
492
+ conversations Conversation[]
493
+ messages CommunicationMessage[]
494
+
495
+ created_at DateTime @default(now())
496
+ updated_at DateTime @updatedAt
497
+ created_by String
498
+ updated_by String
499
+
500
+ @@unique([organisation_id, channel, provider])
501
+ @@index([organisation_id, channel])
502
+ @@index([organisation_id, channel, is_active])
503
+ }
504
+
505
+ /// A logical conversation thread with one external party on one channel.
506
+ /// `external_id` is the channel-native identifier (E.164 phone for WhatsApp/SMS, email address for email).
507
+ ///
508
+ /// `application_id` / `job_description_id` are the *current* recruiting scope
509
+ /// the thread is bound to (the recruiter can switch context, but individual
510
+ /// `CommunicationMessage` rows record the scope they were sent under so the
511
+ /// audit trail is preserved). Both nullable so pre-application sourcing
512
+ /// (no application yet, just a JD) still works.
513
+ model Conversation {
514
+ id String @id @default(uuid())
515
+ organisation_id String
516
+ channel CommChannel
517
+ provider CommProvider
518
+ channel_provider_id String?
519
+ external_id String
520
+ contact_user_id String?
521
+ application_id String?
522
+ job_description_id String?
523
+ provider_thread_id String?
524
+ subject String?
525
+ status String @default("open")
526
+ unread_count Int @default(0)
527
+ last_message_at DateTime?
528
+ metadata Json @default("{}")
529
+
530
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade)
531
+ channel_provider ChannelProviderConfig? @relation(fields: [channel_provider_id], references: [id], onDelete: SetNull)
532
+ application Application? @relation(fields: [application_id], references: [id], onDelete: SetNull)
533
+ job_description JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull)
534
+ messages CommunicationMessage[]
535
+
536
+ created_at DateTime @default(now())
537
+ updated_at DateTime @updatedAt
538
+ created_by String
539
+ updated_by String
540
+
541
+ @@unique([organisation_id, channel, provider, external_id])
542
+ @@index([organisation_id, channel])
543
+ @@index([organisation_id, last_message_at])
544
+ @@index([external_id])
545
+ @@index([organisation_id, application_id])
546
+ @@index([organisation_id, job_description_id])
547
+ }
548
+
549
+ /// Individual message in a conversation. Inbound + outbound share the same model.
550
+ /// `body` is plain text. `attachments` is a JSON array of media descriptors (no binaries persisted).
551
+ /// `metadata` stores raw provider payloads + interactive payloads for audit/debug.
552
+ ///
553
+ /// `application_id` / `job_description_id` are the recruiting scope this
554
+ /// specific message was sent/received under, captured at the time of the
555
+ /// event (not derived from the parent conversation, since a recruiter may
556
+ /// reuse a thread across multiple applications). Both nullable.
557
+ model CommunicationMessage {
558
+ id String @id @default(uuid())
559
+ conversation_id String
560
+ organisation_id String
561
+ channel CommChannel
562
+ provider CommProvider
563
+ channel_provider_id String?
564
+ direction CommDirection
565
+ status CommMessageStatus
566
+ body String?
567
+ from_identifier String
568
+ to_identifier String
569
+ sender_user_id String?
570
+ application_id String?
571
+ job_description_id String?
572
+ provider_message_id String?
573
+ template_name String?
574
+ attachments Json @default("[]")
575
+ metadata Json @default("{}")
576
+ error String?
577
+ sent_at DateTime?
578
+ delivered_at DateTime?
579
+ read_at DateTime?
580
+
581
+ conversation Conversation @relation(fields: [conversation_id], references: [id], onDelete: Cascade)
582
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade)
583
+ channel_provider ChannelProviderConfig? @relation(fields: [channel_provider_id], references: [id], onDelete: SetNull)
584
+ application Application? @relation(fields: [application_id], references: [id], onDelete: SetNull)
585
+ job_description JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull)
586
+
587
+ created_at DateTime @default(now())
588
+ updated_at DateTime @updatedAt
589
+
590
+ @@unique([provider, provider_message_id])
591
+ @@index([conversation_id, created_at])
592
+ @@index([organisation_id, channel, created_at])
593
+ @@index([organisation_id, status])
594
+ @@index([organisation_id, application_id])
595
+ @@index([organisation_id, job_description_id])
596
+ }
597
+
543
598
  model ContactUs {
544
599
  id String @id @default(uuid())
545
600
  name String
@@ -560,14 +615,6 @@ enum RoundType {
560
615
  SCREENING
561
616
  }
562
617
 
563
- enum EvaluationCategory {
564
- EXPERIENCE_SCREENING
565
- TECHNICAL_SCREENING
566
- TECHNICAL_INTERVIEW
567
- BUSINESS_ROUND
568
- BEHAVIORAL_ROUND
569
- }
570
-
571
618
  enum EvaluationRoundFormat {
572
619
  // ────────────────
573
620
  // Screening formats
@@ -637,7 +684,6 @@ model EvaluationPlan {
637
684
  duration Int?
638
685
  duration_unit DurationUnit?
639
686
  deadline Int?
640
- category EvaluationCategory?
641
687
  created_by String
642
688
  updated_by String
643
689
  created_at DateTime @default(now())
@@ -983,48 +1029,45 @@ enum JobDescriptionStatus {
983
1029
  }
984
1030
 
985
1031
  model JobDescription {
986
- id String @id @default(uuid())
1032
+ id String @id @default(uuid())
987
1033
  organisation_id String
988
1034
  hiring_manager_id String?
989
- status JobDescriptionStatus @default(DRAFT)
1035
+ status JobDescriptionStatus @default(DRAFT)
990
1036
  screeningQuestions String[]
991
1037
  recommendedQuestions Json[]
992
1038
  uploaded_job_description_path String?
993
- is_plan_published Boolean @default(false)
994
- is_posted Boolean @default(false)
1039
+ is_plan_published Boolean @default(false)
1040
+ is_posted Boolean @default(false)
995
1041
  summary Json?
996
1042
  ai_insight Json?
997
1043
  job_fit_comparison Json?
998
- target_closing_date DateTime?
999
- closing_date DateTime?
1000
-
1001
- job_number Int?
1002
- job_code String? @unique
1003
1044
  // Audit fields
1004
- created_at DateTime @default(now())
1005
- updated_at DateTime @updatedAt
1006
- created_by String
1007
- updated_by String
1008
- is_active Boolean @default(true)
1009
- openings Int @default(1)
1010
- job_profile_id String?
1011
- job_profile JobProfile? @relation(fields: [job_profile_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1012
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1013
- applications Application[]
1014
- interviews Interview[]
1015
- assignments Assignment[]
1016
- fit_check FitCheck[] // one-to-many link
1017
- job_description_data JobDescriptionData[] // one-to-many link
1018
- evaluationPlan EvaluationPlan[] // relation to evaluation methods
1019
- ongoing_evaluations OngoingEvaluation[] // optional one-to-many
1020
- assignment_library AssignmentLibrary[]
1021
- approvals Approval[] // one-to-many relation
1022
- resumes Resume[] // one-to-many link
1023
- budget Budget?
1024
- hiring_manager User? @relation("HiringManager", fields: [hiring_manager_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1025
- recruiters User[]
1026
- transcripts Transcript[]
1027
- integration_job_syncs IntegrationJobSync[]
1045
+ created_at DateTime @default(now())
1046
+ updated_at DateTime @updatedAt
1047
+ created_by String
1048
+ updated_by String
1049
+ is_active Boolean @default(true)
1050
+ openings Int @default(1)
1051
+ job_profile_id String?
1052
+ job_profile JobProfile? @relation(fields: [job_profile_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1053
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1054
+ applications Application[]
1055
+ interviews Interview[]
1056
+ assignments Assignment[]
1057
+ fit_check FitCheck[] // one-to-many link
1058
+ job_description_data JobDescriptionData[] // one-to-many link
1059
+ evaluationPlan EvaluationPlan[] // relation to evaluation methods
1060
+ ongoing_evaluations OngoingEvaluation[] // optional one-to-many
1061
+ assignment_library AssignmentLibrary[]
1062
+ approvals Approval[] // one-to-many relation
1063
+ resumes Resume[] // one-to-many link
1064
+ budget Budget?
1065
+ hiring_manager User? @relation("HiringManager", fields: [hiring_manager_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1066
+ recruiters User[]
1067
+ transcripts Transcript[]
1068
+ integration_job_syncs IntegrationJobSync[]
1069
+ conversations Conversation[]
1070
+ communication_messages CommunicationMessage[]
1028
1071
 
1029
1072
  @@index([organisation_id])
1030
1073
  @@index([hiring_manager_id])
@@ -1259,8 +1302,6 @@ model Organisation {
1259
1302
  is_active Boolean @default(true)
1260
1303
  alias String? @unique
1261
1304
  logo String?
1262
- org_code String? @unique
1263
- job_sequence Int @default(1)
1264
1305
  applications Application[]
1265
1306
  user_roles UserRole[]
1266
1307
  job_descriptions JobDescription[]
@@ -1280,7 +1321,10 @@ model Organisation {
1280
1321
  assessments Assessment[]
1281
1322
  timezone String @default("Asia/Kolkata")
1282
1323
  organisation_configs OrganisationConfig[]
1283
- activity_events ActivityEvent[]
1324
+
1325
+ channel_provider_configs ChannelProviderConfig[]
1326
+ conversations Conversation[]
1327
+ communication_messages CommunicationMessage[]
1284
1328
 
1285
1329
  @@index([name])
1286
1330
  }
@@ -1572,7 +1616,6 @@ model User {
1572
1616
  refresh_token_auth RefreshToken[] @relation("TokenRefresh")
1573
1617
  zoom_meeting_participants ZoomMeetingParticipant[]
1574
1618
  notes Notes[]
1575
- recruiter_applications Application[] @relation("ApplicationRecruiter")
1576
1619
 
1577
1620
  name String?
1578
1621
  phone String?