@adaptware/eagles-db 0.5.20 → 0.5.22

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 (33) hide show
  1. package/client/edge.js +29 -96
  2. package/client/index-browser.js +18 -85
  3. package/client/index.d.ts +757 -5626
  4. package/client/index.js +29 -96
  5. package/client/package.json +1 -1
  6. package/client/schema.prisma +62 -156
  7. package/client/wasm.js +29 -96
  8. package/package.json +1 -1
  9. package/prisma/.DS_Store +0 -0
  10. package/prisma/schema/activityEvent.prisma +8 -4
  11. package/prisma/schema/applications.prisma +27 -3
  12. package/prisma/schema/integration.prisma +1 -0
  13. package/prisma/schema/migrations/.DS_Store +0 -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/migrations/20260807140000_simplify_offer_status_model/migration.sql +109 -0
  19. package/prisma/schema/offer.prisma +9 -132
  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
  33. package/prisma/schema/migrations/20260804120000_contact_us_optional_website_subject/migration.sql +0 -3
@@ -1,45 +1,8 @@
1
- /// Recruiter/candidate-visible offer lifecycle under Application SELECTED.
2
- /// Distinct from OfferChangeRequest.status (per-ticket workflow).
3
- enum OfferStatus {
4
- /// Offer in flight — see OfferSubstatus for detail.
5
- OPEN
6
- ACCEPTED
7
- DECLINED
8
- EXPIRED
9
- WITHDRAWN
10
- JOINED
11
- NO_SHOW
12
-
13
- @@schema("public")
14
- }
15
-
16
- /// In-flight offer detail — only meaningful when Offer.status = OPEN.
17
- enum OfferSubstatus {
18
- /// Draft offer created; no letter sent yet.
19
- OFFER_CREATED
20
- /// Awaiting executive approval before send.
21
- PENDING_APPROVAL
22
- /// First letter issued to candidate.
23
- OFFER_SENT
24
- /// Candidate opened the current letter.
25
- VIEWED
26
- /// Candidate submitted a change request (ticket OPEN).
27
- CHANGE_REQUESTED
28
- /// Staff marked change request IN_PROGRESS; HR actively working.
29
- CHANGE_UNDER_REVIEW
30
- /// Revised letter sent after negotiation (counter-offer).
31
- COUNTER_OFFER_SENT
32
-
33
- @@schema("public")
34
- }
35
-
36
1
  enum OfferLetterStatus {
37
2
  /// Current issued letter for the offer (at most one per offer; app-enforced).
38
3
  ACTIVE
39
4
  /// Replaced by a newer version; PDF remains immutable.
40
5
  SUPERSEDED
41
- /// Invalidated before meaningful candidate action (e.g. draft discarded).
42
- VOID
43
6
 
44
7
  @@schema("public")
45
8
  }
@@ -75,17 +38,6 @@ enum OfferLetterTemplateScope {
75
38
  @@schema("public")
76
39
  }
77
40
 
78
- enum OfferChangeCategory {
79
- BUDGET
80
- BENEFITS
81
- JOINING_DATE
82
- ROLE_TITLE
83
- LOCATION
84
- OTHER
85
-
86
- @@schema("public")
87
- }
88
-
89
41
  enum WorkMode {
90
42
  REMOTE
91
43
  OFFICE
@@ -94,27 +46,6 @@ enum WorkMode {
94
46
  @@schema("public")
95
47
  }
96
48
 
97
- /// Per change-request ticket workflow (distinct from Offer.substatus).
98
- enum OfferChangeRequestStatus {
99
- OPEN
100
- IN_PROGRESS
101
- /// Staff addressed via revised letter or explicit resolution.
102
- RESOLVED
103
- REJECTED
104
- WITHDRAWN
105
- EXPIRED
106
-
107
- @@schema("public")
108
- }
109
-
110
- enum OfferApprovalStatus {
111
- PENDING
112
- APPROVED
113
- REJECTED
114
-
115
- @@schema("public")
116
- }
117
-
118
49
  model OfferLetterTemplate {
119
50
  id String @id @default(uuid())
120
51
  organisation_id String
@@ -154,6 +85,8 @@ model OfferLetterTemplate {
154
85
  @@schema("public")
155
86
  }
156
87
 
88
+ /// Offer is a data container: terms, letter versions, timeline audit.
89
+ /// Lifecycle lives on Application.offer_substatus — no status enum here.
157
90
  model Offer {
158
91
  id String @id @default(uuid())
159
92
  application_id String @unique
@@ -161,26 +94,21 @@ model Offer {
161
94
  candidate_id String
162
95
  job_description_id String
163
96
  template_id String?
164
- status OfferStatus @default(OPEN)
165
- substatus OfferSubstatus?
166
97
  letter_version_count Int @default(0)
167
- change_request_count Int @default(0)
168
- /// FK to latest ACTIVE letter; avoids MAX(version) on every read.
98
+ /// FK to latest ACTIVE letter; null when NEGOTIATING (v(N) superseded, v(N+1) not generated yet) or PREPARING (no letter yet).
169
99
  current_offer_letter_id String?
170
100
  /// Merge payload: CTC, joining date, role title, location, etc.
171
101
  /// Single structured source of truth — no denormalized term columns.
172
102
  terms Json @default("{}")
173
103
  /// Draft offer-scoped HTML snapshot (never mutates OfferLetterTemplate).
174
104
  draft_edited_html_document_id String?
175
- expires_at DateTime?
176
- /// First letter sent (reporting SLA).
105
+ /// Staff clicked "Mark as sent" (letter is out with candidate).
177
106
  sent_at DateTime?
178
- /// First accept / decline / change request.
107
+ /// First accept / decline recorded on the Offer.
179
108
  responded_at DateTime?
180
109
  accepted_at DateTime?
181
110
  declined_at DateTime?
182
111
  withdrawn_at DateTime?
183
- expired_at DateTime?
184
112
  joined_at DateTime?
185
113
  no_show_at DateTime?
186
114
  withdraw_reason OfferWithdrawReason?
@@ -201,17 +129,10 @@ model Offer {
201
129
  draft_edited_html_document Document? @relation("OfferDraftEditedHtml", fields: [draft_edited_html_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
202
130
  current_offer_letter OfferLetter? @relation("OfferCurrentLetter", fields: [current_offer_letter_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
203
131
  letters OfferLetter[] @relation("OfferLetters")
204
- change_requests OfferChangeRequest[]
205
- approvals OfferApproval[]
206
132
 
207
133
  @@index([organisation_id])
208
- @@index([organisation_id, status])
209
- @@index([organisation_id, substatus])
210
134
  @@index([candidate_id])
211
135
  @@index([job_description_id])
212
- @@index([status])
213
- @@index([substatus])
214
- @@index([expires_at])
215
136
  @@index([current_offer_letter_id])
216
137
  @@index([draft_edited_html_document_id])
217
138
  @@schema("public")
@@ -230,9 +151,10 @@ model OfferLetter {
230
151
  template_document_id String?
231
152
  /// Snapshot of OfferLetterTemplate.version at render time
232
153
  template_version Int?
233
- sent_at DateTime?
234
- viewed_at DateTime?
235
- change_request_note String?
154
+ /// When staff clicked "Generate letter" — the PDF was rendered and the DOCX downloaded.
155
+ generated_at DateTime?
156
+ /// Free-form note attached at generation time (e.g. "Revised for updated CTC").
157
+ generation_note String?
236
158
  /// Soft-delete only — never infer supersession from is_active.
237
159
  is_active Boolean @default(true)
238
160
  created_by String
@@ -245,7 +167,6 @@ model OfferLetter {
245
167
  document Document @relation("OfferLetterPdf", fields: [document_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
246
168
  template OfferLetterTemplate? @relation(fields: [template_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
247
169
  template_document Document? @relation("OfferLetterTemplateSnapshot", fields: [template_document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
248
- change_requests OfferChangeRequest[]
249
170
 
250
171
  @@unique([offer_id, version])
251
172
  @@index([offer_id])
@@ -253,47 +174,3 @@ model OfferLetter {
253
174
  @@index([template_id])
254
175
  @@schema("public")
255
176
  }
256
-
257
- model OfferChangeRequest {
258
- id String @id @default(uuid())
259
- offer_id String
260
- offer_letter_id String
261
- categories OfferChangeCategory[]
262
- note String?
263
- /// Structured payload keyed by category (e.g. BUDGET.expectedCtc)
264
- details Json?
265
- /// Staff note when rejecting (not shown to candidate)
266
- hr_note String?
267
- status OfferChangeRequestStatus @default(OPEN)
268
- resolved_at DateTime?
269
- created_by String
270
- updated_by String
271
- created_at DateTime @default(now())
272
- updated_at DateTime @updatedAt
273
-
274
- offer Offer @relation(fields: [offer_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
275
- offer_letter OfferLetter @relation(fields: [offer_letter_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
276
-
277
- @@index([offer_id, status])
278
- @@index([offer_letter_id])
279
- @@schema("public")
280
- }
281
-
282
- model OfferApproval {
283
- id String @id @default(uuid())
284
- offer_id String
285
- status OfferApprovalStatus @default(PENDING)
286
- note String?
287
- decided_at DateTime?
288
- decided_by String?
289
- created_by String
290
- updated_by String
291
- created_at DateTime @default(now())
292
- updated_at DateTime @updatedAt
293
-
294
- offer Offer @relation(fields: [offer_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
295
-
296
- @@index([offer_id, status])
297
- @@index([offer_id, created_at])
298
- @@schema("public")
299
- }
@@ -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");