@adaptware/eagles-db 0.1.83 → 0.1.84

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 (30) hide show
  1. package/client/edge.js +18 -37
  2. package/client/index-browser.js +13 -32
  3. package/client/index.d.ts +1002 -1170
  4. package/client/index.js +18 -37
  5. package/client/package.json +1 -1
  6. package/client/schema.prisma +43 -59
  7. package/client/wasm.js +13 -32
  8. package/package.json +1 -1
  9. package/prisma/.DS_Store +0 -0
  10. package/prisma/migrations/20260415120000_remove_job_profile_current_phase/migration.sql +2 -0
  11. package/prisma/migrations/20260422120000_add_integration_provider_zoom/migration.sql +2 -0
  12. package/prisma/migrations/20260422140000_add_zoom_meeting_tables/migration.sql +57 -0
  13. package/prisma/migrations/20260422180000_add_zoom_webhook_event/migration.sql +18 -0
  14. package/prisma/migrations/20260423140000_add_interview_platform/migration.sql +6 -0
  15. package/prisma/migrations/20260423150000_remove_interview_zoom_topic/migration.sql +2 -0
  16. package/prisma/migrations/20260423160000_zoom_meeting_uuid/migration.sql +4 -0
  17. package/prisma/migrations/20260424120000_auth_module_user_provider_unique/migration.sql +5 -0
  18. package/prisma/migrations/20260424130000_zoom_meeting_zoom_host_user_id/migration.sql +6 -0
  19. package/prisma/migrations/20260425100000_zoom_participant_user_enum/migration.sql +22 -0
  20. package/prisma/migrations/20260425110000_zoom_participant_zoom_id_required/migration.sql +13 -0
  21. package/prisma/migrations/20260425120000_zoom_participant_id_nullable/migration.sql +4 -0
  22. package/prisma/migrations/20260429140000_drop_evaluation_plan_job_order_unique/migration.sql +5 -0
  23. package/prisma/migrations/20260429180000_eval_plan_timeline_optional_ongoing_duration/migration.sql +15 -0
  24. package/prisma/migrations/20260430120000_drop_assessment_library_metadata_fields/migration.sql +8 -0
  25. package/prisma/migrations/migration_lock.toml +3 -0
  26. package/prisma/schema/assessmentLibrary.prisma +15 -26
  27. package/prisma/schema/evaluationPlan.prisma +1 -2
  28. package/prisma/schema/interview.prisma +20 -21
  29. package/prisma/schema/ongoingEvaluation.prisma +26 -30
  30. package/client/libquery_engine-darwin.dylib.node +0 -0
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "prisma-client-ae719f3b3d43a9f1b3944236fd3132e83186e01c020356d95ee70d90332c232a",
2
+ "name": "prisma-client-ce0ead501ab5f4943030635b9183cffe4d4daabd0bff6b1c5e5c12552b7c8110",
3
3
  "main": "index.js",
4
4
  "types": "index.d.ts",
5
5
  "browser": "index-browser.js",
@@ -208,33 +208,22 @@ model Assessment {
208
208
 
209
209
  /// Defines how an assessment is conducted.
210
210
 
211
- enum AssessmentCategory {
212
- MCQ
213
- COMPETENCY
214
- CASE_STUDY
215
- ASSIGNMENT
216
- }
217
-
218
211
  model AssessmentLibrary {
219
- id String @id @default(uuid())
220
- title String
221
- assessment_type String?
222
- description String?
223
- assessment_category AssessmentCategory
224
- time_required Int
225
- passing_score Float?
226
- max_score Float?
227
- organisation_id String
228
- created_by_ai Boolean @default(false)
229
- created_at DateTime @default(now())
230
- updated_at DateTime @updatedAt
231
- created_by String
232
- updated_by String
233
- is_active Boolean @default(true)
234
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
235
- questions Question[] // One assessment → many questions
236
- assessments Assessment[]
237
- evaluation_Plans EvaluationPlan[]
212
+ id String @id @default(uuid())
213
+ title String
214
+ time_required Int
215
+ passing_score Float?
216
+ max_score Float?
217
+ organisation_id String
218
+ created_at DateTime @default(now())
219
+ updated_at DateTime @updatedAt
220
+ created_by String
221
+ updated_by String
222
+ is_active Boolean @default(true)
223
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
224
+ questions Question[] // One assessment → many questions
225
+ assessments Assessment[]
226
+ evaluation_Plans EvaluationPlan[]
238
227
 
239
228
  @@index([organisation_id])
240
229
  }
@@ -523,7 +512,7 @@ model EvaluationPlan {
523
512
  elimination_round Boolean @default(false)
524
513
  evaluation_type EvaluationType
525
514
  type_of_round RoundType
526
- timeline Int
515
+ timeline Int?
527
516
  order_no Int?
528
517
  details Json?
529
518
  plan_type EvaluationPlanType @default(GENERIC)
@@ -545,7 +534,6 @@ model EvaluationPlan {
545
534
  assignment_library AssignmentLibrary? @relation(fields: [assignment_library_id], references: [id], onDelete: SetNull)
546
535
  ongoing_evaluations OngoingEvaluation[]
547
536
 
548
- @@unique([job_description_id, order_no])
549
537
  @@index([job_description_id])
550
538
  }
551
539
 
@@ -774,7 +762,6 @@ model Interview {
774
762
  application_id String?
775
763
  resume_id String
776
764
  job_description_id String
777
- calendar_event_id String?
778
765
  /// Data
779
766
  room_name String?
780
767
  interview_summary String[]
@@ -785,6 +772,7 @@ model Interview {
785
772
  recording_url String?
786
773
  interview_status InterviewStatus @default(SCHEDULED)
787
774
  interview_platform InterviewPlatform @default(TREADSPACE)
775
+ google_event_id String?
788
776
  /// Old Feedback fields will be deprecated soon
789
777
  ai_interview_feedback InterviewFeedback?
790
778
  interview_feedback InterviewFeedback?
@@ -1023,16 +1011,6 @@ model Notes {
1023
1011
  @@index([user_id, created_at])
1024
1012
  }
1025
1013
 
1026
- enum OngoingEvaluationStatus {
1027
- LOCKED
1028
- ACTION_REQUIRED
1029
- IN_PROGRESS
1030
- EVALUATED
1031
- CLEARED
1032
- NOT_CLEARED
1033
- SKIPPED
1034
- }
1035
-
1036
1014
  enum OngoingEvaluationState {
1037
1015
  NOT_STARTED
1038
1016
  IN_PROGRESS
@@ -1051,37 +1029,24 @@ enum OngoingEvaluationRoundStatus {
1051
1029
  }
1052
1030
 
1053
1031
  model OngoingEvaluation {
1032
+ // Primary Key
1054
1033
  id String @id @default(uuid())
1034
+ // Foreign Keys
1035
+ organisation_id String
1055
1036
  application_id String
1056
1037
  candidate_id String
1057
1038
  resume_id String
1058
- organisation_id String
1059
1039
  job_description_id String
1060
1040
  evaluation_plan_id String
1061
1041
  interview_id String? @unique
1062
1042
  assignment_id String? @unique
1063
1043
  assessment_id String? @unique
1064
- status OngoingEvaluationStatus?
1044
+ // Data Fields
1065
1045
  state OngoingEvaluationState? @default(NOT_STARTED)
1066
1046
  round_status OngoingEvaluationRoundStatus? @default(NOT_SCHEDULED)
1067
1047
  comments String? @default("")
1068
- // Relations
1069
- jobDescription JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull)
1070
- application Application @relation(fields: [application_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1071
- candidate User? @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1072
- resume Resume? @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1073
- organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1074
- evaluation_plan EvaluationPlan @relation(fields: [evaluation_plan_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1075
- interview Interview? @relation(fields: [interview_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1076
- assignment Assignment?
1077
- assessment Assessment? @relation(fields: [assessment_id], references: [id], onDelete: SetNull)
1078
- created_at DateTime @default(now())
1079
- updated_at DateTime @updatedAt
1080
- created_by String
1081
- updated_by String
1082
- is_active Boolean @default(true)
1083
- is_current Boolean @default(false)
1084
- // Evaluation Plan Details Will be stored only when candidate starts for the evaluation round
1048
+ completed_at DateTime?
1049
+ /// Evaluation Plan Fields Filled After Round Started
1085
1050
  title String?
1086
1051
  description String?
1087
1052
  order_no Int?
@@ -1091,8 +1056,27 @@ model OngoingEvaluation {
1091
1056
  elimination_round Boolean? @default(false)
1092
1057
  evaluation_type EvaluationType?
1093
1058
  type_of_round RoundType?
1094
- timeline Int?
1059
+ duration Int?
1060
+ deadline Int?
1061
+ duration_unit DurationUnit?
1095
1062
  details Json?
1063
+ // Audit Fields
1064
+ created_at DateTime @default(now())
1065
+ updated_at DateTime @updatedAt
1066
+ created_by String
1067
+ updated_by String
1068
+ is_active Boolean @default(true)
1069
+ is_current Boolean @default(false)
1070
+ // Relations
1071
+ jobDescription JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull)
1072
+ application Application @relation(fields: [application_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1073
+ candidate User? @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1074
+ resume Resume? @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1075
+ organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1076
+ evaluation_plan EvaluationPlan @relation(fields: [evaluation_plan_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1077
+ interview Interview? @relation(fields: [interview_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1078
+ assignment Assignment?
1079
+ assessment Assessment? @relation(fields: [assessment_id], references: [id], onDelete: SetNull)
1096
1080
 
1097
1081
  @@unique([application_id, evaluation_plan_id])
1098
1082
  @@index([application_id])
package/client/wasm.js CHANGED
@@ -236,14 +236,10 @@ exports.Prisma.AssessmentScalarFieldEnum = {
236
236
  exports.Prisma.AssessmentLibraryScalarFieldEnum = {
237
237
  id: 'id',
238
238
  title: 'title',
239
- assessment_type: 'assessment_type',
240
- description: 'description',
241
- assessment_category: 'assessment_category',
242
239
  time_required: 'time_required',
243
240
  passing_score: 'passing_score',
244
241
  max_score: 'max_score',
245
242
  organisation_id: 'organisation_id',
246
- created_by_ai: 'created_by_ai',
247
243
  created_at: 'created_at',
248
244
  updated_at: 'updated_at',
249
245
  created_by: 'created_by',
@@ -526,7 +522,6 @@ exports.Prisma.InterviewScalarFieldEnum = {
526
522
  application_id: 'application_id',
527
523
  resume_id: 'resume_id',
528
524
  job_description_id: 'job_description_id',
529
- calendar_event_id: 'calendar_event_id',
530
525
  room_name: 'room_name',
531
526
  interview_summary: 'interview_summary',
532
527
  scheduled_start_time: 'scheduled_start_time',
@@ -536,6 +531,7 @@ exports.Prisma.InterviewScalarFieldEnum = {
536
531
  recording_url: 'recording_url',
537
532
  interview_status: 'interview_status',
538
533
  interview_platform: 'interview_platform',
534
+ google_event_id: 'google_event_id',
539
535
  ai_interview_feedback: 'ai_interview_feedback',
540
536
  interview_feedback: 'interview_feedback',
541
537
  overall_feedback: 'overall_feedback',
@@ -666,25 +662,19 @@ exports.Prisma.NotesScalarFieldEnum = {
666
662
 
667
663
  exports.Prisma.OngoingEvaluationScalarFieldEnum = {
668
664
  id: 'id',
665
+ organisation_id: 'organisation_id',
669
666
  application_id: 'application_id',
670
667
  candidate_id: 'candidate_id',
671
668
  resume_id: 'resume_id',
672
- organisation_id: 'organisation_id',
673
669
  job_description_id: 'job_description_id',
674
670
  evaluation_plan_id: 'evaluation_plan_id',
675
671
  interview_id: 'interview_id',
676
672
  assignment_id: 'assignment_id',
677
673
  assessment_id: 'assessment_id',
678
- status: 'status',
679
674
  state: 'state',
680
675
  round_status: 'round_status',
681
676
  comments: 'comments',
682
- created_at: 'created_at',
683
- updated_at: 'updated_at',
684
- created_by: 'created_by',
685
- updated_by: 'updated_by',
686
- is_active: 'is_active',
687
- is_current: 'is_current',
677
+ completed_at: 'completed_at',
688
678
  title: 'title',
689
679
  description: 'description',
690
680
  order_no: 'order_no',
@@ -694,8 +684,16 @@ exports.Prisma.OngoingEvaluationScalarFieldEnum = {
694
684
  elimination_round: 'elimination_round',
695
685
  evaluation_type: 'evaluation_type',
696
686
  type_of_round: 'type_of_round',
697
- timeline: 'timeline',
698
- details: 'details'
687
+ duration: 'duration',
688
+ deadline: 'deadline',
689
+ duration_unit: 'duration_unit',
690
+ details: 'details',
691
+ created_at: 'created_at',
692
+ updated_at: 'updated_at',
693
+ created_by: 'created_by',
694
+ updated_by: 'updated_by',
695
+ is_active: 'is_active',
696
+ is_current: 'is_current'
699
697
  };
700
698
 
701
699
  exports.Prisma.OrganisationScalarFieldEnum = {
@@ -986,13 +984,6 @@ exports.ApplicationStatus = exports.$Enums.ApplicationStatus = {
986
984
  REJECTED: 'REJECTED'
987
985
  };
988
986
 
989
- exports.AssessmentCategory = exports.$Enums.AssessmentCategory = {
990
- MCQ: 'MCQ',
991
- COMPETENCY: 'COMPETENCY',
992
- CASE_STUDY: 'CASE_STUDY',
993
- ASSIGNMENT: 'ASSIGNMENT'
994
- };
995
-
996
987
  exports.AssignmentStatus = exports.$Enums.AssignmentStatus = {
997
988
  AVAILABLE: 'AVAILABLE',
998
989
  SCHEDULED: 'SCHEDULED',
@@ -1130,16 +1121,6 @@ exports.JobProfileStatus = exports.$Enums.JobProfileStatus = {
1130
1121
  COMPLETE: 'COMPLETE'
1131
1122
  };
1132
1123
 
1133
- exports.OngoingEvaluationStatus = exports.$Enums.OngoingEvaluationStatus = {
1134
- LOCKED: 'LOCKED',
1135
- ACTION_REQUIRED: 'ACTION_REQUIRED',
1136
- IN_PROGRESS: 'IN_PROGRESS',
1137
- EVALUATED: 'EVALUATED',
1138
- CLEARED: 'CLEARED',
1139
- NOT_CLEARED: 'NOT_CLEARED',
1140
- SKIPPED: 'SKIPPED'
1141
- };
1142
-
1143
1124
  exports.OngoingEvaluationState = exports.$Enums.OngoingEvaluationState = {
1144
1125
  NOT_STARTED: 'NOT_STARTED',
1145
1126
  IN_PROGRESS: 'IN_PROGRESS',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptware/eagles-db",
3
- "version": "0.1.83",
3
+ "version": "0.1.84",
4
4
  "description": "A Prisma client package for Treadspace database operations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
Binary file
@@ -0,0 +1,2 @@
1
+ -- AlterTable
2
+ ALTER TABLE "JobProfile" DROP COLUMN IF EXISTS "current_phase";
@@ -0,0 +1,2 @@
1
+ -- AlterEnum (re-run safe only if your PG version supports IF NOT EXISTS; otherwise apply once)
2
+ ALTER TYPE "IntegrationProvider" ADD VALUE 'ZOOM';
@@ -0,0 +1,57 @@
1
+ -- CreateTable
2
+ CREATE TABLE "ZoomMeeting" (
3
+ "id" TEXT NOT NULL,
4
+ "interview_id" TEXT NOT NULL,
5
+ "zoom_meeting_id" TEXT NOT NULL,
6
+ "meeting_number" TEXT NOT NULL,
7
+ "join_url" TEXT NOT NULL,
8
+ "start_url" TEXT,
9
+ "password" TEXT,
10
+ "topic" TEXT,
11
+ "scheduled_start_time" TIMESTAMP(3),
12
+ "scheduled_end_time" TIMESTAMP(3),
13
+ "is_active" BOOLEAN NOT NULL DEFAULT true,
14
+ "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
15
+ "updated_at" TIMESTAMP(3) NOT NULL,
16
+ "created_by" TEXT NOT NULL,
17
+ "updated_by" TEXT NOT NULL,
18
+
19
+ CONSTRAINT "ZoomMeeting_pkey" PRIMARY KEY ("id")
20
+ );
21
+
22
+ -- CreateTable
23
+ CREATE TABLE "ZoomMeetingParticipant" (
24
+ "id" TEXT NOT NULL,
25
+ "zoom_meeting_row_id" TEXT NOT NULL,
26
+ "zoom_participant_id" TEXT,
27
+ "user_name" TEXT,
28
+ "user_email" TEXT,
29
+ "role" TEXT,
30
+ "join_time" TIMESTAMP(3),
31
+ "leave_time" TIMESTAMP(3),
32
+ "is_active" BOOLEAN NOT NULL DEFAULT true,
33
+ "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
34
+ "updated_at" TIMESTAMP(3) NOT NULL,
35
+ "created_by" TEXT NOT NULL,
36
+ "updated_by" TEXT NOT NULL,
37
+
38
+ CONSTRAINT "ZoomMeetingParticipant_pkey" PRIMARY KEY ("id")
39
+ );
40
+
41
+ -- CreateIndex
42
+ CREATE UNIQUE INDEX "ZoomMeeting_interview_id_key" ON "ZoomMeeting"("interview_id");
43
+
44
+ -- CreateIndex
45
+ CREATE INDEX "ZoomMeeting_interview_id_idx" ON "ZoomMeeting"("interview_id");
46
+
47
+ -- CreateIndex
48
+ CREATE INDEX "ZoomMeeting_zoom_meeting_id_idx" ON "ZoomMeeting"("zoom_meeting_id");
49
+
50
+ -- CreateIndex
51
+ CREATE INDEX "ZoomMeetingParticipant_zoom_meeting_row_id_idx" ON "ZoomMeetingParticipant"("zoom_meeting_row_id");
52
+
53
+ -- AddForeignKey
54
+ ALTER TABLE "ZoomMeeting" ADD CONSTRAINT "ZoomMeeting_interview_id_fkey" FOREIGN KEY ("interview_id") REFERENCES "Interview"("id") ON DELETE CASCADE ON UPDATE CASCADE;
55
+
56
+ -- AddForeignKey
57
+ ALTER TABLE "ZoomMeetingParticipant" ADD CONSTRAINT "ZoomMeetingParticipant_zoom_meeting_row_id_fkey" FOREIGN KEY ("zoom_meeting_row_id") REFERENCES "ZoomMeeting"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,18 @@
1
+ -- CreateTable
2
+ CREATE TABLE "ZoomWebhookEvent" (
3
+ "id" TEXT NOT NULL,
4
+ "dedupe_key" TEXT NOT NULL,
5
+ "event" TEXT NOT NULL,
6
+ "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
7
+
8
+ CONSTRAINT "ZoomWebhookEvent_pkey" PRIMARY KEY ("id")
9
+ );
10
+
11
+ -- CreateIndex
12
+ CREATE UNIQUE INDEX "ZoomWebhookEvent_dedupe_key_key" ON "ZoomWebhookEvent"("dedupe_key");
13
+
14
+ -- CreateIndex
15
+ CREATE INDEX "ZoomWebhookEvent_event_idx" ON "ZoomWebhookEvent"("event");
16
+
17
+ -- CreateIndex
18
+ CREATE INDEX "ZoomWebhookEvent_created_at_idx" ON "ZoomWebhookEvent"("created_at");
@@ -0,0 +1,6 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "InterviewPlatform" AS ENUM ('TREADSPACE', 'ZOOM');
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "Interview" ADD COLUMN "interview_platform" "InterviewPlatform" NOT NULL DEFAULT 'TREADSPACE';
6
+ ALTER TABLE "Interview" ADD COLUMN "zoom_topic" TEXT;
@@ -0,0 +1,2 @@
1
+ -- AlterTable
2
+ ALTER TABLE "Interview" DROP COLUMN IF EXISTS "zoom_topic";
@@ -0,0 +1,4 @@
1
+ -- Zoom meeting instance UUID for RTMS `meeting.rtms_started` correlation (webhook `meeting_uuid`).
2
+ ALTER TABLE "ZoomMeeting" ADD COLUMN IF NOT EXISTS "zoom_meeting_uuid" TEXT;
3
+
4
+ CREATE INDEX IF NOT EXISTS "ZoomMeeting_zoom_meeting_uuid_idx" ON "ZoomMeeting"("zoom_meeting_uuid");
@@ -0,0 +1,5 @@
1
+ -- AlterTable
2
+ ALTER TABLE "AuthModule" ADD COLUMN "metadata" JSONB NOT NULL DEFAULT '{}';
3
+
4
+ -- CreateIndex
5
+ CREATE UNIQUE INDEX "AuthModule_user_id_provider_key" ON "AuthModule"("user_id", "provider");
@@ -0,0 +1,6 @@
1
+ -- AlterTable
2
+ ALTER TABLE "ZoomMeeting" ADD COLUMN "zoom_host_user_id" TEXT;
3
+
4
+ UPDATE "ZoomMeeting" SET "zoom_host_user_id" = "created_by";
5
+
6
+ ALTER TABLE "ZoomMeeting" ALTER COLUMN "zoom_host_user_id" SET NOT NULL;
@@ -0,0 +1,22 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "ZoomMeetingParticipantRole" AS ENUM ('CANDIDATE', 'INTERVIEWER');
3
+
4
+ -- Participant rows are re-derived on the next Zoom meeting upsert; old webhook denormalized rows are dropped.
5
+ TRUNCATE TABLE "ZoomMeetingParticipant";
6
+
7
+ -- AlterTable
8
+ ALTER TABLE "ZoomMeetingParticipant" DROP COLUMN "zoom_participant_id",
9
+ DROP COLUMN "user_name",
10
+ DROP COLUMN "user_email",
11
+ DROP COLUMN "join_time",
12
+ DROP COLUMN "leave_time",
13
+ DROP COLUMN "role";
14
+
15
+ ALTER TABLE "ZoomMeetingParticipant" ADD COLUMN "role" "ZoomMeetingParticipantRole" NOT NULL;
16
+ ALTER TABLE "ZoomMeetingParticipant" ADD COLUMN "user_id" TEXT NOT NULL;
17
+
18
+ -- AddForeignKey
19
+ ALTER TABLE "ZoomMeetingParticipant" ADD CONSTRAINT "ZoomMeetingParticipant_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
20
+
21
+ -- CreateIndex
22
+ CREATE INDEX "ZoomMeetingParticipant_user_id_idx" ON "ZoomMeetingParticipant"("user_id");
@@ -0,0 +1,13 @@
1
+ -- AlterTable
2
+ ALTER TABLE "ZoomMeetingParticipant" ADD COLUMN "zoom_participant_id" TEXT NOT NULL DEFAULT '';
3
+
4
+ UPDATE "ZoomMeetingParticipant" zmp
5
+ SET "zoom_participant_id" = COALESCE(NULLIF(TRIM(am."provider_account_id"), ''), '')
6
+ FROM "AuthModule" am
7
+ WHERE am."user_id" = zmp."user_id"
8
+ AND am."provider"::text = 'ZOOM'
9
+ AND am."is_active" = true;
10
+
11
+ ALTER TABLE "ZoomMeetingParticipant" ALTER COLUMN "zoom_participant_id" DROP DEFAULT;
12
+
13
+ CREATE INDEX "ZoomMeetingParticipant_zoom_participant_id_idx" ON "ZoomMeetingParticipant"("zoom_participant_id");
@@ -0,0 +1,4 @@
1
+ -- Optional: only present when that User has Zoom OAuth linked (typically interviewer; often unknown for candidate).
2
+ UPDATE "ZoomMeetingParticipant" SET "zoom_participant_id" = NULL WHERE "zoom_participant_id" = '';
3
+
4
+ ALTER TABLE "ZoomMeetingParticipant" ALTER COLUMN "zoom_participant_id" DROP NOT NULL;
@@ -0,0 +1,5 @@
1
+ -- DropUnique: allows reorder/swap without a two-phase order_no dance; ordering is enforced in app logic.
2
+ ALTER TABLE "EvaluationPlan" DROP CONSTRAINT IF EXISTS "EvaluationPlan_job_description_id_order_no_key";
3
+
4
+ -- Non-unique index for lookups by job + order (e.g. swap).
5
+ CREATE INDEX "EvaluationPlan_job_description_id_order_no_idx" ON "EvaluationPlan"("job_description_id", "order_no");
@@ -0,0 +1,15 @@
1
+ -- EvaluationPlan.timeline optional (legacy column; app uses duration/deadline/duration_unit).
2
+ ALTER TABLE "EvaluationPlan" ALTER COLUMN "timeline" DROP NOT NULL;
3
+
4
+ -- OngoingEvaluation: denormalized duration fields; migrate legacy timeline into duration (minutes) then drop timeline.
5
+ ALTER TABLE "OngoingEvaluation" ADD COLUMN "duration" INTEGER;
6
+ ALTER TABLE "OngoingEvaluation" ADD COLUMN "deadline" INTEGER;
7
+ ALTER TABLE "OngoingEvaluation" ADD COLUMN "duration_unit" "DurationUnit";
8
+
9
+ UPDATE "OngoingEvaluation"
10
+ SET
11
+ "duration" = "timeline",
12
+ "duration_unit" = 'MINUTES'::"DurationUnit"
13
+ WHERE "timeline" IS NOT NULL AND "duration" IS NULL;
14
+
15
+ ALTER TABLE "OngoingEvaluation" DROP COLUMN IF EXISTS "timeline";
@@ -0,0 +1,8 @@
1
+ -- Remove unused AssessmentLibrary metadata columns.
2
+ ALTER TABLE "AssessmentLibrary" DROP COLUMN IF EXISTS "assessment_type";
3
+ ALTER TABLE "AssessmentLibrary" DROP COLUMN IF EXISTS "description";
4
+ ALTER TABLE "AssessmentLibrary" DROP COLUMN IF EXISTS "assessment_category";
5
+ ALTER TABLE "AssessmentLibrary" DROP COLUMN IF EXISTS "created_by_ai";
6
+
7
+ -- Enum only referenced by dropped column.
8
+ DROP TYPE IF EXISTS "AssessmentCategory";
@@ -0,0 +1,3 @@
1
+ # Please do not edit this file manually
2
+ # It should be added in your version-control system (e.g. Git)
3
+ provider = "postgresql"
@@ -1,32 +1,21 @@
1
1
  /// Defines how an assessment is conducted.
2
2
 
3
- enum AssessmentCategory {
4
- MCQ
5
- COMPETENCY
6
- CASE_STUDY
7
- ASSIGNMENT
8
- }
9
-
10
3
  model AssessmentLibrary {
11
- id String @id @default(uuid())
12
- title String
13
- assessment_type String?
14
- description String?
15
- assessment_category AssessmentCategory
16
- time_required Int
17
- passing_score Float?
18
- max_score Float?
19
- organisation_id String
20
- created_by_ai Boolean @default(false)
21
- created_at DateTime @default(now())
22
- updated_at DateTime @updatedAt
23
- created_by String
24
- updated_by String
25
- is_active Boolean @default(true)
26
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
27
- questions Question[] // One assessment → many questions
28
- assessments Assessment[]
29
- evaluation_Plans EvaluationPlan[]
4
+ id String @id @default(uuid())
5
+ title String
6
+ time_required Int
7
+ passing_score Float?
8
+ max_score Float?
9
+ organisation_id String
10
+ created_at DateTime @default(now())
11
+ updated_at DateTime @updatedAt
12
+ created_by String
13
+ updated_by String
14
+ is_active Boolean @default(true)
15
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
16
+ questions Question[] // One assessment → many questions
17
+ assessments Assessment[]
18
+ evaluation_Plans EvaluationPlan[]
30
19
 
31
20
  @@index([organisation_id])
32
21
  }
@@ -66,7 +66,7 @@ model EvaluationPlan {
66
66
  elimination_round Boolean @default(false)
67
67
  evaluation_type EvaluationType
68
68
  type_of_round RoundType
69
- timeline Int
69
+ timeline Int?
70
70
  order_no Int?
71
71
  details Json?
72
72
  plan_type EvaluationPlanType @default(GENERIC)
@@ -88,6 +88,5 @@ model EvaluationPlan {
88
88
  assignment_library AssignmentLibrary? @relation(fields: [assignment_library_id], references: [id], onDelete: SetNull)
89
89
  ongoing_evaluations OngoingEvaluation[]
90
90
 
91
- @@unique([job_description_id, order_no])
92
91
  @@index([job_description_id])
93
92
  }
@@ -30,7 +30,6 @@ model Interview {
30
30
  application_id String?
31
31
  resume_id String
32
32
  job_description_id String
33
- calendar_event_id String?
34
33
  /// Data
35
34
  room_name String?
36
35
  interview_summary String[]
@@ -41,6 +40,7 @@ model Interview {
41
40
  recording_url String?
42
41
  interview_status InterviewStatus @default(SCHEDULED)
43
42
  interview_platform InterviewPlatform @default(TREADSPACE)
43
+ google_event_id String?
44
44
  /// Old Feedback fields will be deprecated soon
45
45
  ai_interview_feedback InterviewFeedback?
46
46
  interview_feedback InterviewFeedback?
@@ -55,27 +55,26 @@ model Interview {
55
55
  final_feedback Json?
56
56
 
57
57
  /// Audit fields
58
- created_at DateTime @default(now())
59
- updated_at DateTime @updatedAt
60
- created_by String
61
- updated_by String
62
- is_active Boolean @default(true)
58
+ created_at DateTime @default(now())
59
+ updated_at DateTime @updatedAt
60
+ created_by String
61
+ updated_by String
62
+ is_active Boolean @default(true)
63
63
  // Relations
64
- candidate User? @relation("CandidateInterviews", fields: [candidate_id], references: [id], onDelete: SetNull)
65
- interviewer User? @relation("InterviewerInterviews", fields: [interviewer_id], references: [id], onDelete: SetNull)
66
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
67
- job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
68
- resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
69
- evaluation_plan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
70
- application Application? @relation(fields: [application_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
71
- ongoing_evaluation OngoingEvaluation?
72
- transcripts Transcript[]
73
- suggestions Suggestion[]
74
- feedback Feedback[]
75
- interviewNotes InterviewNotes[]
76
- liveAnalysis LiveAnalysis[]
77
- zoom_meeting ZoomMeeting?
78
-
64
+ candidate User? @relation("CandidateInterviews", fields: [candidate_id], references: [id], onDelete: SetNull)
65
+ interviewer User? @relation("InterviewerInterviews", fields: [interviewer_id], references: [id], onDelete: SetNull)
66
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
67
+ job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
68
+ resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
69
+ evaluation_plan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
70
+ application Application? @relation(fields: [application_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
71
+ ongoing_evaluation OngoingEvaluation?
72
+ transcripts Transcript[]
73
+ suggestions Suggestion[]
74
+ feedback Feedback[]
75
+ interviewNotes InterviewNotes[]
76
+ liveAnalysis LiveAnalysis[]
77
+ zoom_meeting ZoomMeeting?
79
78
  @@unique([interviewer_id, candidate_id, evaluation_plan_id])
80
79
  @@index([candidate_id])
81
80
  @@index([interviewer_id])