@adaptware/eagles-db 0.1.85 → 0.1.86

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 (31) hide show
  1. package/client/edge.js +17 -44
  2. package/client/index-browser.js +12 -39
  3. package/client/index.d.ts +902 -1192
  4. package/client/index.js +17 -44
  5. package/client/package.json +1 -1
  6. package/client/schema.prisma +42 -66
  7. package/client/wasm.js +12 -39
  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/20260430140000_drop_question_question_type/migration.sql +5 -0
  26. package/prisma/migrations/migration_lock.toml +3 -0
  27. package/prisma/schema/assessmentLibrary.prisma +15 -26
  28. package/prisma/schema/evaluationPlan.prisma +1 -2
  29. package/prisma/schema/ongoingEvaluation.prisma +26 -30
  30. package/prisma/schema/questions.prisma +0 -8
  31. package/client/libquery_engine-darwin.dylib.node +0 -0
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "prisma-client-132116727cdcdad441587fda0233ddbe5933e4b700a944210a2e30459c4f4576",
2
+ "name": "prisma-client-7ea14210ef898197a704ebe0c3225e71ec2e6f116fe2e1a030b6358d8c508f97",
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
  }
@@ -524,7 +513,7 @@ model EvaluationPlan {
524
513
  elimination_round Boolean @default(false)
525
514
  evaluation_type EvaluationType
526
515
  type_of_round RoundType
527
- timeline Int
516
+ timeline Int?
528
517
  order_no Int?
529
518
  details Json?
530
519
  plan_type EvaluationPlanType @default(GENERIC)
@@ -546,7 +535,6 @@ model EvaluationPlan {
546
535
  assignment_library AssignmentLibrary? @relation(fields: [assignment_library_id], references: [id], onDelete: SetNull)
547
536
  ongoing_evaluations OngoingEvaluation[]
548
537
 
549
- @@unique([job_description_id, order_no])
550
538
  @@index([job_description_id])
551
539
  }
552
540
 
@@ -1024,16 +1012,6 @@ model Notes {
1024
1012
  @@index([user_id, created_at])
1025
1013
  }
1026
1014
 
1027
- enum OngoingEvaluationStatus {
1028
- LOCKED
1029
- ACTION_REQUIRED
1030
- IN_PROGRESS
1031
- EVALUATED
1032
- CLEARED
1033
- NOT_CLEARED
1034
- SKIPPED
1035
- }
1036
-
1037
1015
  enum OngoingEvaluationState {
1038
1016
  NOT_STARTED
1039
1017
  IN_PROGRESS
@@ -1052,37 +1030,24 @@ enum OngoingEvaluationRoundStatus {
1052
1030
  }
1053
1031
 
1054
1032
  model OngoingEvaluation {
1033
+ // Primary Key
1055
1034
  id String @id @default(uuid())
1035
+ // Foreign Keys
1036
+ organisation_id String
1056
1037
  application_id String
1057
1038
  candidate_id String
1058
1039
  resume_id String
1059
- organisation_id String
1060
1040
  job_description_id String
1061
1041
  evaluation_plan_id String
1062
1042
  interview_id String? @unique
1063
1043
  assignment_id String? @unique
1064
1044
  assessment_id String? @unique
1065
- status OngoingEvaluationStatus?
1045
+ // Data Fields
1066
1046
  state OngoingEvaluationState? @default(NOT_STARTED)
1067
1047
  round_status OngoingEvaluationRoundStatus? @default(NOT_SCHEDULED)
1068
1048
  comments String? @default("")
1069
- // Relations
1070
- jobDescription JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull)
1071
- application Application @relation(fields: [application_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1072
- candidate User? @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1073
- resume Resume? @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1074
- organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1075
- evaluation_plan EvaluationPlan @relation(fields: [evaluation_plan_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1076
- interview Interview? @relation(fields: [interview_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1077
- assignment Assignment?
1078
- assessment Assessment? @relation(fields: [assessment_id], references: [id], onDelete: SetNull)
1079
- created_at DateTime @default(now())
1080
- updated_at DateTime @updatedAt
1081
- created_by String
1082
- updated_by String
1083
- is_active Boolean @default(true)
1084
- is_current Boolean @default(false)
1085
- // Evaluation Plan Details Will be stored only when candidate starts for the evaluation round
1049
+ completed_at DateTime?
1050
+ /// Evaluation Plan Fields Filled After Round Started
1086
1051
  title String?
1087
1052
  description String?
1088
1053
  order_no Int?
@@ -1092,8 +1057,27 @@ model OngoingEvaluation {
1092
1057
  elimination_round Boolean? @default(false)
1093
1058
  evaluation_type EvaluationType?
1094
1059
  type_of_round RoundType?
1095
- timeline Int?
1060
+ duration Int?
1061
+ deadline Int?
1062
+ duration_unit DurationUnit?
1096
1063
  details Json?
1064
+ // Audit Fields
1065
+ created_at DateTime @default(now())
1066
+ updated_at DateTime @updatedAt
1067
+ created_by String
1068
+ updated_by String
1069
+ is_active Boolean @default(true)
1070
+ is_current Boolean @default(false)
1071
+ // Relations
1072
+ jobDescription JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull)
1073
+ application Application @relation(fields: [application_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1074
+ candidate User? @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1075
+ resume Resume? @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1076
+ organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1077
+ evaluation_plan EvaluationPlan @relation(fields: [evaluation_plan_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1078
+ interview Interview? @relation(fields: [interview_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
1079
+ assignment Assignment?
1080
+ assessment Assessment? @relation(fields: [assessment_id], references: [id], onDelete: SetNull)
1097
1081
 
1098
1082
  @@unique([application_id, evaluation_plan_id])
1099
1083
  @@index([application_id])
@@ -1209,20 +1193,12 @@ enum Difficulty {
1209
1193
  HARD // challenging questions
1210
1194
  }
1211
1195
 
1212
- enum QuestionType {
1213
- MCQ
1214
- TRUE_FALSE
1215
- THEORY
1216
- CODING
1217
- }
1218
-
1219
1196
  model Question {
1220
1197
  id String @id @default(uuid())
1221
1198
  assessment_library_id String?
1222
1199
  evaluation_plan_id String?
1223
1200
  candidate_id String?
1224
1201
  skill String?
1225
- question_type QuestionType?
1226
1202
  question String
1227
1203
  answer String
1228
1204
  options String[] // For MCQ's
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',
@@ -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 = {
@@ -754,7 +752,6 @@ exports.Prisma.QuestionScalarFieldEnum = {
754
752
  evaluation_plan_id: 'evaluation_plan_id',
755
753
  candidate_id: 'candidate_id',
756
754
  skill: 'skill',
757
- question_type: 'question_type',
758
755
  question: 'question',
759
756
  answer: 'answer',
760
757
  options: 'options',
@@ -987,13 +984,6 @@ exports.ApplicationStatus = exports.$Enums.ApplicationStatus = {
987
984
  REJECTED: 'REJECTED'
988
985
  };
989
986
 
990
- exports.AssessmentCategory = exports.$Enums.AssessmentCategory = {
991
- MCQ: 'MCQ',
992
- COMPETENCY: 'COMPETENCY',
993
- CASE_STUDY: 'CASE_STUDY',
994
- ASSIGNMENT: 'ASSIGNMENT'
995
- };
996
-
997
987
  exports.AssignmentStatus = exports.$Enums.AssignmentStatus = {
998
988
  AVAILABLE: 'AVAILABLE',
999
989
  SCHEDULED: 'SCHEDULED',
@@ -1132,16 +1122,6 @@ exports.JobProfileStatus = exports.$Enums.JobProfileStatus = {
1132
1122
  COMPLETE: 'COMPLETE'
1133
1123
  };
1134
1124
 
1135
- exports.OngoingEvaluationStatus = exports.$Enums.OngoingEvaluationStatus = {
1136
- LOCKED: 'LOCKED',
1137
- ACTION_REQUIRED: 'ACTION_REQUIRED',
1138
- IN_PROGRESS: 'IN_PROGRESS',
1139
- EVALUATED: 'EVALUATED',
1140
- CLEARED: 'CLEARED',
1141
- NOT_CLEARED: 'NOT_CLEARED',
1142
- SKIPPED: 'SKIPPED'
1143
- };
1144
-
1145
1125
  exports.OngoingEvaluationState = exports.$Enums.OngoingEvaluationState = {
1146
1126
  NOT_STARTED: 'NOT_STARTED',
1147
1127
  IN_PROGRESS: 'IN_PROGRESS',
@@ -1176,13 +1156,6 @@ exports.AsyncOperationStatus = exports.$Enums.AsyncOperationStatus = {
1176
1156
  CANCELLED: 'CANCELLED'
1177
1157
  };
1178
1158
 
1179
- exports.QuestionType = exports.$Enums.QuestionType = {
1180
- MCQ: 'MCQ',
1181
- TRUE_FALSE: 'TRUE_FALSE',
1182
- THEORY: 'THEORY',
1183
- CODING: 'CODING'
1184
- };
1185
-
1186
1159
  exports.Difficulty = exports.$Enums.Difficulty = {
1187
1160
  EASY: 'EASY',
1188
1161
  MEDIUM: 'MEDIUM',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptware/eagles-db",
3
- "version": "0.1.85",
3
+ "version": "0.1.86",
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,5 @@
1
+ -- DropQuestion.question_type and enum QuestionType (replaced by structure-based inference in app code)
2
+
3
+ ALTER TABLE "Question" DROP COLUMN IF EXISTS "question_type";
4
+
5
+ DROP TYPE IF EXISTS "QuestionType";
@@ -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
  }