@adaptware/eagles-db 0.4.46 → 0.5.2

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 (32) hide show
  1. package/client/edge.js +192 -6
  2. package/client/index-browser.js +187 -1
  3. package/client/index.d.ts +66407 -45772
  4. package/client/index.js +192 -6
  5. package/client/package.json +1 -1
  6. package/client/schema.prisma +338 -31
  7. package/client/wasm.js +192 -6
  8. package/package.json +1 -1
  9. package/prisma/schema/budget.prisma +4 -0
  10. package/prisma/schema/candidateProfile.prisma +9 -8
  11. package/prisma/schema/department.prisma +89 -0
  12. package/prisma/schema/hiringPlan.prisma +197 -0
  13. package/prisma/schema/jobDescription.prisma +10 -0
  14. package/prisma/schema/migrations/20260610100000_add_communication/migration.sql +131 -0
  15. package/prisma/schema/migrations/20260610170000_add_communication_application_scope/migration.sql +45 -0
  16. package/prisma/schema/migrations/20260718120000_add_hiring_plan/migration.sql +208 -0
  17. package/prisma/schema/migrations/20260718140000_hiring_plan_assumptions/migration.sql +2 -0
  18. package/prisma/schema/organisation.prisma +3 -1
  19. package/prisma/schema/user.prisma +2 -0
  20. package/client/libquery_engine-darwin.dylib.node +0 -0
  21. package/prisma/migrations/20260519120000_migrate_shortlisted_to_selected/migration.sql +0 -2
  22. package/prisma/schema/.DS_Store +0 -0
  23. package/prisma/schema/migrations/20260519120000_add_analytics_schema/migration.sql +0 -84
  24. package/prisma/schema/migrations/20260625120000_add_interviewer_analytics/migration.sql +0 -26
  25. package/prisma/schema/migrations/20260629120000_add_user_lifecycle_activity_events/migration.sql +0 -13
  26. package/prisma/schema/migrations/20260629140000_drop_organisation_org_code/migration.sql +0 -2
  27. package/prisma/schema/migrations/20260629160000_employee_codes_dual_interviewer_analytics/migration.sql +0 -87
  28. package/prisma/schema/migrations/20260630120000_add_application_sources/migration.sql +0 -38
  29. package/prisma/schema/migrations/20260701120000_add_source_effectiveness_analytics/migration.sql +0 -40
  30. package/prisma/schema/migrations/20260702120000_add_analytics_daily_tables/migration.sql +0 -232
  31. package/prisma/schema/migrations/20260716120000_evaluation_category_four_values/migration.sql +0 -204
  32. package/prisma/schema/migrations/20260716130000_application_withdrawn_analytics/migration.sql +0 -31
@@ -0,0 +1,208 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "HiringPlanStatus" AS ENUM ('DRAFT', 'ACTIVE', 'CLOSED');
3
+
4
+ -- CreateEnum
5
+ CREATE TYPE "PeriodType" AS ENUM ('ANNUAL');
6
+
7
+ -- CreateEnum
8
+ CREATE TYPE "EmployeeStatus" AS ENUM ('ACTIVE', 'ATTRITION_EXPECTED', 'DEPARTED');
9
+
10
+ -- CreateEnum
11
+ CREATE TYPE "AttritionRisk" AS ENUM ('LOW', 'MEDIUM', 'HIGH');
12
+
13
+ -- CreateEnum
14
+ CREATE TYPE "ReviewRating" AS ENUM (
15
+ 'OUTSTANDING',
16
+ 'EXCEEDS_EXPECTATIONS',
17
+ 'MEETS_EXPECTATIONS',
18
+ 'NEEDS_IMPROVEMENT',
19
+ 'UNSATISFACTORY'
20
+ );
21
+
22
+ -- CreateEnum
23
+ CREATE TYPE "PlannedCandidateStatus" AS ENUM (
24
+ 'IDENTIFIED',
25
+ 'IN_PIPELINE',
26
+ 'OFFER',
27
+ 'SELECTED',
28
+ 'DECLINED'
29
+ );
30
+
31
+ -- CreateTable
32
+ CREATE TABLE "HiringPlan" (
33
+ "id" TEXT NOT NULL,
34
+ "organisation_id" TEXT NOT NULL,
35
+ "fiscal_year" INTEGER NOT NULL,
36
+ "period_type" "PeriodType" NOT NULL DEFAULT 'ANNUAL',
37
+ "currency" TEXT NOT NULL DEFAULT 'INR',
38
+ "status" "HiringPlanStatus" NOT NULL DEFAULT 'DRAFT',
39
+ "total_headcount_budget" INTEGER,
40
+ "total_cost_budget" DECIMAL(18,2),
41
+ "notes" TEXT,
42
+ "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
43
+ "updated_at" TIMESTAMP(3) NOT NULL,
44
+ "created_by" TEXT NOT NULL,
45
+ "updated_by" TEXT NOT NULL,
46
+ "is_active" BOOLEAN NOT NULL DEFAULT true,
47
+
48
+ CONSTRAINT "HiringPlan_pkey" PRIMARY KEY ("id")
49
+ );
50
+
51
+ -- CreateTable
52
+ CREATE TABLE "HiringPlanLine" (
53
+ "id" TEXT NOT NULL,
54
+ "hiring_plan_id" TEXT NOT NULL,
55
+ "business_unit" TEXT,
56
+ "level" TEXT,
57
+ "location" TEXT,
58
+ "role" TEXT,
59
+ "planned_headcount" INTEGER NOT NULL DEFAULT 1,
60
+ "cost_per_hire" DECIMAL(18,2) NOT NULL,
61
+ "start_month" INTEGER NOT NULL DEFAULT 1,
62
+ "hire_schedule" JSONB,
63
+ "job_description_id" TEXT,
64
+ "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
65
+ "updated_at" TIMESTAMP(3) NOT NULL,
66
+ "created_by" TEXT NOT NULL,
67
+ "updated_by" TEXT NOT NULL,
68
+ "is_active" BOOLEAN NOT NULL DEFAULT true,
69
+
70
+ CONSTRAINT "HiringPlanLine_pkey" PRIMARY KEY ("id")
71
+ );
72
+
73
+ -- CreateTable
74
+ CREATE TABLE "Employee" (
75
+ "id" TEXT NOT NULL,
76
+ "organisation_id" TEXT NOT NULL,
77
+ "employee_code" TEXT,
78
+ "name" TEXT,
79
+ "email" TEXT,
80
+ "gender" TEXT,
81
+ "business_unit" TEXT,
82
+ "level" TEXT,
83
+ "location" TEXT,
84
+ "role" TEXT,
85
+ "employment_type" "JobType",
86
+ "starting_designation" TEXT,
87
+ "current_designation" TEXT,
88
+ "start_date" TIMESTAMP(3),
89
+ "starting_salary" DECIMAL(18,2),
90
+ "current_comp" DECIMAL(18,2) NOT NULL,
91
+ "currency" TEXT NOT NULL DEFAULT 'INR',
92
+ "last_increment_date" TIMESTAMP(3),
93
+ "last_increment_amount" DECIMAL(18,2),
94
+ "last_increment_pct" DECIMAL(8,4),
95
+ "last_review_date" TIMESTAMP(3),
96
+ "last_review_rating" "ReviewRating",
97
+ "last_feedback_date" TIMESTAMP(3),
98
+ "last_feedback_summary" TEXT,
99
+ "status" "EmployeeStatus" NOT NULL DEFAULT 'ACTIVE',
100
+ "attrition_risk" "AttritionRisk",
101
+ "expected_exit_date" TIMESTAMP(3),
102
+ "backfill_plan_line_id" TEXT,
103
+ "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
104
+ "updated_at" TIMESTAMP(3) NOT NULL,
105
+ "created_by" TEXT NOT NULL,
106
+ "updated_by" TEXT NOT NULL,
107
+ "is_active" BOOLEAN NOT NULL DEFAULT true,
108
+
109
+ CONSTRAINT "Employee_pkey" PRIMARY KEY ("id")
110
+ );
111
+
112
+ -- CreateTable
113
+ CREATE TABLE "PlannedCandidate" (
114
+ "id" TEXT NOT NULL,
115
+ "hiring_plan_line_id" TEXT NOT NULL,
116
+ "candidate_profile_id" TEXT,
117
+ "name" TEXT,
118
+ "status" "PlannedCandidateStatus" NOT NULL DEFAULT 'IDENTIFIED',
119
+ "note" TEXT,
120
+ "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
121
+ "updated_at" TIMESTAMP(3) NOT NULL,
122
+ "created_by" TEXT NOT NULL,
123
+ "updated_by" TEXT NOT NULL,
124
+ "is_active" BOOLEAN NOT NULL DEFAULT true,
125
+
126
+ CONSTRAINT "PlannedCandidate_pkey" PRIMARY KEY ("id")
127
+ );
128
+
129
+ -- AlterTable
130
+ ALTER TABLE "JobDescription" ADD COLUMN "hiring_plan_line_id" TEXT;
131
+
132
+ -- AlterTable
133
+ ALTER TABLE "Budget" ADD COLUMN "hiring_plan_line_id" TEXT;
134
+
135
+ -- CreateIndex
136
+ CREATE UNIQUE INDEX "HiringPlan_organisation_id_fiscal_year_key" ON "HiringPlan"("organisation_id", "fiscal_year");
137
+
138
+ -- CreateIndex
139
+ CREATE INDEX "HiringPlan_organisation_id_idx" ON "HiringPlan"("organisation_id");
140
+
141
+ -- CreateIndex
142
+ CREATE INDEX "HiringPlan_status_idx" ON "HiringPlan"("status");
143
+
144
+ -- CreateIndex
145
+ CREATE INDEX "HiringPlanLine_hiring_plan_id_idx" ON "HiringPlanLine"("hiring_plan_id");
146
+
147
+ -- CreateIndex
148
+ CREATE INDEX "HiringPlanLine_job_description_id_idx" ON "HiringPlanLine"("job_description_id");
149
+
150
+ -- CreateIndex
151
+ CREATE INDEX "HiringPlanLine_business_unit_level_location_role_idx" ON "HiringPlanLine"("business_unit", "level", "location", "role");
152
+
153
+ -- CreateIndex
154
+ CREATE UNIQUE INDEX "Employee_organisation_id_employee_code_key" ON "Employee"("organisation_id", "employee_code");
155
+
156
+ -- CreateIndex
157
+ CREATE INDEX "Employee_organisation_id_idx" ON "Employee"("organisation_id");
158
+
159
+ -- CreateIndex
160
+ CREATE INDEX "Employee_status_idx" ON "Employee"("status");
161
+
162
+ -- CreateIndex
163
+ CREATE INDEX "Employee_business_unit_level_location_role_idx" ON "Employee"("business_unit", "level", "location", "role");
164
+
165
+ -- CreateIndex
166
+ CREATE INDEX "Employee_backfill_plan_line_id_idx" ON "Employee"("backfill_plan_line_id");
167
+
168
+ -- CreateIndex
169
+ CREATE INDEX "PlannedCandidate_hiring_plan_line_id_idx" ON "PlannedCandidate"("hiring_plan_line_id");
170
+
171
+ -- CreateIndex
172
+ CREATE INDEX "PlannedCandidate_candidate_profile_id_idx" ON "PlannedCandidate"("candidate_profile_id");
173
+
174
+ -- CreateIndex
175
+ CREATE INDEX "PlannedCandidate_status_idx" ON "PlannedCandidate"("status");
176
+
177
+ -- CreateIndex
178
+ CREATE INDEX "JobDescription_hiring_plan_line_id_idx" ON "JobDescription"("hiring_plan_line_id");
179
+
180
+ -- CreateIndex
181
+ CREATE INDEX "Budget_hiring_plan_line_id_idx" ON "Budget"("hiring_plan_line_id");
182
+
183
+ -- AddForeignKey
184
+ ALTER TABLE "HiringPlan" ADD CONSTRAINT "HiringPlan_organisation_id_fkey" FOREIGN KEY ("organisation_id") REFERENCES "Organisation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
185
+
186
+ -- AddForeignKey
187
+ ALTER TABLE "HiringPlanLine" ADD CONSTRAINT "HiringPlanLine_hiring_plan_id_fkey" FOREIGN KEY ("hiring_plan_id") REFERENCES "HiringPlan"("id") ON DELETE CASCADE ON UPDATE CASCADE;
188
+
189
+ -- AddForeignKey
190
+ ALTER TABLE "HiringPlanLine" ADD CONSTRAINT "HiringPlanLine_job_description_id_fkey" FOREIGN KEY ("job_description_id") REFERENCES "JobDescription"("id") ON DELETE SET NULL ON UPDATE CASCADE;
191
+
192
+ -- AddForeignKey
193
+ ALTER TABLE "Employee" ADD CONSTRAINT "Employee_organisation_id_fkey" FOREIGN KEY ("organisation_id") REFERENCES "Organisation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
194
+
195
+ -- AddForeignKey
196
+ ALTER TABLE "Employee" ADD CONSTRAINT "Employee_backfill_plan_line_id_fkey" FOREIGN KEY ("backfill_plan_line_id") REFERENCES "HiringPlanLine"("id") ON DELETE SET NULL ON UPDATE CASCADE;
197
+
198
+ -- AddForeignKey
199
+ ALTER TABLE "PlannedCandidate" ADD CONSTRAINT "PlannedCandidate_hiring_plan_line_id_fkey" FOREIGN KEY ("hiring_plan_line_id") REFERENCES "HiringPlanLine"("id") ON DELETE CASCADE ON UPDATE CASCADE;
200
+
201
+ -- AddForeignKey
202
+ ALTER TABLE "PlannedCandidate" ADD CONSTRAINT "PlannedCandidate_candidate_profile_id_fkey" FOREIGN KEY ("candidate_profile_id") REFERENCES "CandidateProfile"("id") ON DELETE SET NULL ON UPDATE CASCADE;
203
+
204
+ -- AddForeignKey
205
+ ALTER TABLE "JobDescription" ADD CONSTRAINT "JobDescription_hiring_plan_line_id_fkey" FOREIGN KEY ("hiring_plan_line_id") REFERENCES "HiringPlanLine"("id") ON DELETE SET NULL ON UPDATE CASCADE;
206
+
207
+ -- AddForeignKey
208
+ ALTER TABLE "Budget" ADD CONSTRAINT "Budget_hiring_plan_line_id_fkey" FOREIGN KEY ("hiring_plan_line_id") REFERENCES "HiringPlanLine"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -0,0 +1,2 @@
1
+ -- AlterTable
2
+ ALTER TABLE "HiringPlan" ADD COLUMN "assumptions" JSONB;
@@ -59,7 +59,9 @@ model Organisation {
59
59
  job_application_templates JobApplicationTemplate[]
60
60
  sources Source[]
61
61
  evaluation_criteria EvaluationCriteria[]
62
- // departments Department[]
62
+ departments Department[]
63
+ hiring_plans HiringPlan[]
64
+ employees Employee[]
63
65
 
64
66
  @@index([name])
65
67
  @@schema("public")
@@ -95,6 +95,8 @@ model User {
95
95
  employee_number Int?
96
96
  employee_code String? @unique
97
97
 
98
+ department_members DepartmentMember[] @relation("DepartmentMemberships")
99
+
98
100
  @@index([role_id])
99
101
  @@index([permission_id])
100
102
  @@index([organisation_id])
@@ -1,2 +0,0 @@
1
- -- Migrate legacy terminal-positive status to SELECTED (SHORTLISTED enum value retained but unused).
2
- UPDATE applications SET status = 'SELECTED' WHERE status = 'SHORTLISTED';
Binary file
@@ -1,84 +0,0 @@
1
- -- CreateSchema
2
- CREATE SCHEMA IF NOT EXISTS "analytics";
3
-
4
- -- CreateEnum
5
- CREATE TYPE "analytics"."RoundResult" AS ENUM ('PASSED', 'FAILED');
6
-
7
- -- CreateTable
8
- CREATE TABLE "analytics"."round_analytics" (
9
- "id" TEXT NOT NULL,
10
- "organisation_id" TEXT NOT NULL,
11
- "application_id" TEXT NOT NULL,
12
- "candidate_id" TEXT NOT NULL,
13
- "job_description_id" TEXT NOT NULL,
14
- "evaluation_plan_id" TEXT NOT NULL,
15
- "round_id" TEXT NOT NULL,
16
- "round_name" TEXT,
17
- "evaluation_category" "EvaluationCategory",
18
- "round_type" "RoundType",
19
- "assigned_at" TIMESTAMP(3),
20
- "interview_created_at" TIMESTAMP(3),
21
- "interview_scheduled_at" TIMESTAMP(3),
22
- "interview_started_at" TIMESTAMP(3),
23
- "interview_completed_at" TIMESTAMP(3),
24
- "interview_evaluated_at" TIMESTAMP(3),
25
- "round_completed_at" TIMESTAMP(3),
26
- "round_result" "analytics"."RoundResult",
27
- "round_result_at" TIMESTAMP(3),
28
- "scheduling_duration_minutes" INTEGER,
29
- "interview_duration_minutes" INTEGER,
30
- "feedback_duration_minutes" INTEGER,
31
- "decision_duration_minutes" INTEGER,
32
- "total_round_duration_minutes" INTEGER,
33
- "is_custom" BOOLEAN NOT NULL DEFAULT false,
34
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
35
- "updated_at" TIMESTAMP(3) NOT NULL,
36
-
37
- CONSTRAINT "round_analytics_pkey" PRIMARY KEY ("id")
38
- );
39
-
40
- -- CreateTable
41
- CREATE TABLE "analytics"."job_round_analytics" (
42
- "id" TEXT NOT NULL,
43
- "organisation_id" TEXT NOT NULL,
44
- "job_description_id" TEXT NOT NULL,
45
- "evaluation_plan_id" TEXT NOT NULL,
46
- "round_name" TEXT NOT NULL,
47
- "evaluation_category" "EvaluationCategory",
48
- "is_custom" BOOLEAN NOT NULL DEFAULT false,
49
- "assigned_count" INTEGER NOT NULL DEFAULT 0,
50
- "completed_count" INTEGER NOT NULL DEFAULT 0,
51
- "passed_count" INTEGER NOT NULL DEFAULT 0,
52
- "failed_count" INTEGER NOT NULL DEFAULT 0,
53
- "withdrawn_count" INTEGER NOT NULL DEFAULT 0,
54
- "no_show_count" INTEGER NOT NULL DEFAULT 0,
55
- "total_completion_minutes" BIGINT NOT NULL DEFAULT 0,
56
- "avg_completion_minutes" DOUBLE PRECISION,
57
- "updated_at" TIMESTAMP(3) NOT NULL,
58
-
59
- CONSTRAINT "job_round_analytics_pkey" PRIMARY KEY ("id")
60
- );
61
-
62
- -- CreateIndex
63
- CREATE UNIQUE INDEX "round_analytics_round_id_key" ON "analytics"."round_analytics"("round_id");
64
-
65
- -- CreateIndex
66
- CREATE INDEX "round_analytics_organisation_id_idx" ON "analytics"."round_analytics"("organisation_id");
67
-
68
- -- CreateIndex
69
- CREATE INDEX "round_analytics_job_description_id_idx" ON "analytics"."round_analytics"("job_description_id");
70
-
71
- -- CreateIndex
72
- CREATE INDEX "round_analytics_application_id_idx" ON "analytics"."round_analytics"("application_id");
73
-
74
- -- CreateIndex
75
- CREATE INDEX "round_analytics_candidate_id_idx" ON "analytics"."round_analytics"("candidate_id");
76
-
77
- -- CreateIndex
78
- CREATE INDEX "round_analytics_evaluation_category_idx" ON "analytics"."round_analytics"("evaluation_category");
79
-
80
- -- CreateIndex
81
- CREATE INDEX "round_analytics_round_result_idx" ON "analytics"."round_analytics"("round_result");
82
-
83
- -- CreateIndex
84
- CREATE UNIQUE INDEX "job_round_analytics_job_description_id_evaluation_plan_id_key" ON "analytics"."job_round_analytics"("job_description_id", "evaluation_plan_id");
@@ -1,26 +0,0 @@
1
- -- CreateTable
2
- CREATE TABLE "analytics"."interviewer_analytics" (
3
- "id" TEXT NOT NULL,
4
- "organisation_id" TEXT NOT NULL,
5
- "user_id" TEXT NOT NULL,
6
- "name" TEXT,
7
- "employee_id" TEXT,
8
- "interview_count" INTEGER NOT NULL DEFAULT 0,
9
- "accepted_count" INTEGER NOT NULL DEFAULT 0,
10
- "rejected_count" INTEGER NOT NULL DEFAULT 0,
11
- "unsure_count" INTEGER NOT NULL DEFAULT 0,
12
- "ai_disagreement_count" INTEGER NOT NULL DEFAULT 0,
13
- "ai_disagreement_percent" DOUBLE PRECISION,
14
- "avg_difficulty" DOUBLE PRECISION,
15
- "avg_supportiveness" DOUBLE PRECISION,
16
- "avg_topics_coverage_percent" DOUBLE PRECISION,
17
- "updated_at" TIMESTAMP(3) NOT NULL,
18
-
19
- CONSTRAINT "interviewer_analytics_pkey" PRIMARY KEY ("id")
20
- );
21
-
22
- -- CreateIndex
23
- CREATE UNIQUE INDEX "interviewer_analytics_organisation_id_user_id_key" ON "analytics"."interviewer_analytics"("organisation_id", "user_id");
24
-
25
- -- CreateIndex
26
- CREATE INDEX "interviewer_analytics_organisation_id_idx" ON "analytics"."interviewer_analytics"("organisation_id");
@@ -1,13 +0,0 @@
1
- -- AlterEnum
2
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_INVITED';
3
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_INVITATION_RESENT';
4
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_CREATED';
5
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_INVITATION_ACCEPTED';
6
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_INVITATION_EXPIRED';
7
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_DEACTIVATED';
8
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_REACTIVATED';
9
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_ROLE_CHANGED';
10
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_PROFILE_COMPLETED';
11
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'CANDIDATE_REGISTERED';
12
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'CANDIDATE_CREATED';
13
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'CANDIDATE_PROFILE_COMPLETED';
@@ -1,2 +0,0 @@
1
- ALTER TABLE "Organisation" DROP COLUMN IF EXISTS "org_code";
2
- ALTER TABLE "Organisation" ADD COLUMN IF NOT EXISTS "employee_sequence" INTEGER NOT NULL DEFAULT 1;
@@ -1,87 +0,0 @@
1
- ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "employee_number" INTEGER;
2
- ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "employee_code" TEXT;
3
-
4
- CREATE UNIQUE INDEX IF NOT EXISTS "User_employee_code_key" ON "User"("employee_code");
5
- CREATE INDEX IF NOT EXISTS "User_organisation_id_employee_number_idx" ON "User"("organisation_id", "employee_number");
6
-
7
- DROP TABLE IF EXISTS "analytics"."interviewer_analytics";
8
-
9
- CREATE TABLE "analytics"."interviewer_organisation_analytics" (
10
- "id" TEXT NOT NULL,
11
- "organisation_id" TEXT NOT NULL,
12
- "user_id" TEXT NOT NULL,
13
- "name" TEXT,
14
- "employee_id" TEXT,
15
- "interview_count" INTEGER NOT NULL DEFAULT 0,
16
- "accepted_count" INTEGER NOT NULL DEFAULT 0,
17
- "rejected_count" INTEGER NOT NULL DEFAULT 0,
18
- "unsure_count" INTEGER NOT NULL DEFAULT 0,
19
- "ai_disagreement_count" INTEGER NOT NULL DEFAULT 0,
20
- "ai_disagreement_percent" DOUBLE PRECISION,
21
- "avg_difficulty" DOUBLE PRECISION,
22
- "avg_supportiveness" DOUBLE PRECISION,
23
- "avg_topics_coverage_percent" DOUBLE PRECISION,
24
- "updated_at" TIMESTAMP(3) NOT NULL,
25
-
26
- CONSTRAINT "interviewer_organisation_analytics_pkey" PRIMARY KEY ("id")
27
- );
28
-
29
- CREATE UNIQUE INDEX "interviewer_organisation_analytics_organisation_id_user_id_key"
30
- ON "analytics"."interviewer_organisation_analytics"("organisation_id", "user_id");
31
- CREATE INDEX "interviewer_organisation_analytics_organisation_id_idx"
32
- ON "analytics"."interviewer_organisation_analytics"("organisation_id");
33
- CREATE INDEX "interviewer_organisation_analytics_organisation_id_user_id_idx"
34
- ON "analytics"."interviewer_organisation_analytics"("organisation_id", "user_id");
35
-
36
- CREATE TABLE "analytics"."interviewer_job_analytics" (
37
- "id" TEXT NOT NULL,
38
- "organisation_id" TEXT NOT NULL,
39
- "user_id" TEXT NOT NULL,
40
- "job_description_id" TEXT NOT NULL,
41
- "hiring_manager_id" TEXT,
42
- "department" TEXT,
43
- "location" TEXT,
44
- "role_title" TEXT,
45
- "job_code" TEXT,
46
- "opened_at" TIMESTAMP(3),
47
- "name" TEXT,
48
- "employee_id" TEXT,
49
- "interview_count" INTEGER NOT NULL DEFAULT 0,
50
- "accepted_count" INTEGER NOT NULL DEFAULT 0,
51
- "rejected_count" INTEGER NOT NULL DEFAULT 0,
52
- "unsure_count" INTEGER NOT NULL DEFAULT 0,
53
- "ai_disagreement_count" INTEGER NOT NULL DEFAULT 0,
54
- "ai_disagreement_percent" DOUBLE PRECISION,
55
- "avg_difficulty" DOUBLE PRECISION,
56
- "avg_supportiveness" DOUBLE PRECISION,
57
- "avg_topics_coverage_percent" DOUBLE PRECISION,
58
- "updated_at" TIMESTAMP(3) NOT NULL,
59
-
60
- CONSTRAINT "interviewer_job_analytics_pkey" PRIMARY KEY ("id")
61
- );
62
-
63
- CREATE UNIQUE INDEX "interviewer_job_analytics_organisation_id_user_id_job_descri_key"
64
- ON "analytics"."interviewer_job_analytics"("organisation_id", "user_id", "job_description_id");
65
- CREATE INDEX "interviewer_job_analytics_organisation_id_job_description_id_idx"
66
- ON "analytics"."interviewer_job_analytics"("organisation_id", "job_description_id");
67
- CREATE INDEX "interviewer_job_analytics_organisation_id_hiring_manager_id_idx"
68
- ON "analytics"."interviewer_job_analytics"("organisation_id", "hiring_manager_id");
69
- CREATE INDEX "interviewer_job_analytics_organisation_id_department_idx"
70
- ON "analytics"."interviewer_job_analytics"("organisation_id", "department");
71
- CREATE INDEX "interviewer_job_analytics_organisation_id_location_idx"
72
- ON "analytics"."interviewer_job_analytics"("organisation_id", "location");
73
- CREATE INDEX "interviewer_job_analytics_organisation_id_user_id_idx"
74
- ON "analytics"."interviewer_job_analytics"("organisation_id", "user_id");
75
-
76
- CREATE INDEX IF NOT EXISTS "job_round_analytics_organisation_id_idx"
77
- ON "analytics"."job_round_analytics"("organisation_id");
78
- CREATE INDEX IF NOT EXISTS "job_round_analytics_organisation_id_hiring_manager_id_idx"
79
- ON "analytics"."job_round_analytics"("organisation_id", "hiring_manager_id");
80
- CREATE INDEX IF NOT EXISTS "job_round_analytics_job_description_id_idx"
81
- ON "analytics"."job_round_analytics"("job_description_id");
82
-
83
- CREATE INDEX IF NOT EXISTS "pipeline_distribution_analytics_job_description_id_idx"
84
- ON "analytics"."pipeline_distribution_analytics"("job_description_id");
85
-
86
- CREATE INDEX IF NOT EXISTS "open_job_analytics_job_description_id_idx"
87
- ON "analytics"."open_job_analytics"("job_description_id");
@@ -1,38 +0,0 @@
1
- -- CreateEnum
2
- CREATE TYPE "public"."SourceCategory" AS ENUM ('JOB_BOARD', 'REFERRAL', 'AGENCY', 'SOCIAL_MEDIA', 'CAREERS_PAGE', 'EVENT', 'OTHER');
3
-
4
- -- CreateTable
5
- CREATE TABLE "public"."Source" (
6
- "id" TEXT NOT NULL,
7
- "organisation_id" TEXT NOT NULL,
8
- "name" TEXT NOT NULL,
9
- "category" "public"."SourceCategory",
10
- "parent_source_id" TEXT,
11
- "colour" TEXT,
12
- "description" TEXT,
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
-
17
- CONSTRAINT "Source_pkey" PRIMARY KEY ("id")
18
- );
19
-
20
- -- CreateIndex
21
- CREATE UNIQUE INDEX "Source_organisation_id_name_key" ON "public"."Source"("organisation_id", "name");
22
- CREATE INDEX "Source_organisation_id_idx" ON "public"."Source"("organisation_id");
23
- CREATE INDEX "Source_organisation_id_category_idx" ON "public"."Source"("organisation_id", "category");
24
- CREATE INDEX "Source_organisation_id_is_active_idx" ON "public"."Source"("organisation_id", "is_active");
25
- CREATE INDEX "Source_parent_source_id_idx" ON "public"."Source"("parent_source_id");
26
-
27
- -- AddForeignKey
28
- ALTER TABLE "public"."Source" ADD CONSTRAINT "Source_organisation_id_fkey" FOREIGN KEY ("organisation_id") REFERENCES "public"."Organisation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
29
- ALTER TABLE "public"."Source" ADD CONSTRAINT "Source_parent_source_id_fkey" FOREIGN KEY ("parent_source_id") REFERENCES "public"."Source"("id") ON DELETE SET NULL ON UPDATE CASCADE;
30
-
31
- -- AlterTable
32
- ALTER TABLE "public"."Application" ADD COLUMN "source_id" TEXT;
33
-
34
- -- CreateIndex
35
- CREATE INDEX "Application_source_id_idx" ON "public"."Application"("source_id");
36
-
37
- -- AddForeignKey
38
- ALTER TABLE "public"."Application" ADD CONSTRAINT "Application_source_id_fkey" FOREIGN KEY ("source_id") REFERENCES "public"."Source"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -1,40 +0,0 @@
1
- CREATE TABLE "analytics"."source_effectiveness_analytics" (
2
- "id" TEXT NOT NULL,
3
- "organisation_id" TEXT NOT NULL,
4
- "job_description_id" TEXT NOT NULL,
5
- "source_id" TEXT NOT NULL,
6
- "source_name" TEXT NOT NULL,
7
- "source_category" "public"."SourceCategory",
8
- "source_colour" TEXT,
9
- "job_code" TEXT,
10
- "job_number" INTEGER,
11
- "role_title" TEXT,
12
- "hiring_manager_id" TEXT,
13
- "applications_count" INTEGER NOT NULL DEFAULT 0,
14
- "screened_count" INTEGER NOT NULL DEFAULT 0,
15
- "evaluated_count" INTEGER NOT NULL DEFAULT 0,
16
- "rejected_count" INTEGER NOT NULL DEFAULT 0,
17
- "shortlisted_count" INTEGER NOT NULL DEFAULT 0,
18
- "offered_count" INTEGER NOT NULL DEFAULT 0,
19
- "offer_accepted_count" INTEGER NOT NULL DEFAULT 0,
20
- "offer_declined_count" INTEGER NOT NULL DEFAULT 0,
21
- "withdrawn_count" INTEGER NOT NULL DEFAULT 0,
22
- "hired_count" INTEGER NOT NULL DEFAULT 0,
23
- "total_fit_score" DOUBLE PRECISION NOT NULL DEFAULT 0,
24
- "fit_score_sample_count" INTEGER NOT NULL DEFAULT 0,
25
- "average_fit_score" DOUBLE PRECISION,
26
- "updated_at" TIMESTAMP(3) NOT NULL,
27
-
28
- CONSTRAINT "source_effectiveness_analytics_pkey" PRIMARY KEY ("id")
29
- );
30
-
31
- CREATE UNIQUE INDEX "source_effectiveness_analytics_organisation_id_job_descripti_key"
32
- ON "analytics"."source_effectiveness_analytics"("organisation_id", "job_description_id", "source_id");
33
- CREATE INDEX "source_effectiveness_analytics_organisation_id_idx"
34
- ON "analytics"."source_effectiveness_analytics"("organisation_id");
35
- CREATE INDEX "source_effectiveness_analytics_organisation_id_source_id_idx"
36
- ON "analytics"."source_effectiveness_analytics"("organisation_id", "source_id");
37
- CREATE INDEX "source_effectiveness_analytics_organisation_id_hiring_manag_idx"
38
- ON "analytics"."source_effectiveness_analytics"("organisation_id", "hiring_manager_id");
39
- CREATE INDEX "source_effectiveness_analytics_job_description_id_idx"
40
- ON "analytics"."source_effectiveness_analytics"("job_description_id");