@adaptware/eagles-db 0.5.47 → 0.5.49

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptware/eagles-db",
3
- "version": "0.5.47",
3
+ "version": "0.5.49",
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
+ -- Migrate legacy terminal-positive status to SELECTED (SHORTLISTED enum value retained but unused).
2
+ UPDATE applications SET status = 'SELECTED' WHERE status = 'SHORTLISTED';
Binary file
@@ -25,57 +25,58 @@ enum AiAssistanceMode {
25
25
  }
26
26
 
27
27
  model Interview {
28
- id String @id @default(uuid())
28
+ id String @id @default(uuid())
29
29
  /// Foreign keys
30
- organisation_id String
31
- candidate_id String
32
- interviewer_id String?
33
- evaluation_plan_id String
34
- application_id String?
35
- resume_id String
36
- job_description_id String
37
- calendar_event_id String?
30
+ organisation_id String
31
+ candidate_id String
32
+ interviewer_id String?
33
+ evaluation_plan_id String
34
+ application_id String?
35
+ resume_id String
36
+ job_description_id String
37
+ calendar_event_id String?
38
+ calendar_events Json?
38
39
  /// Data
39
- room_name String?
40
+ room_name String?
40
41
  /// @deprecated Prefer `ai_feedback.feedback` (narrative string on AI feedback JSON).
41
- interview_summary String[]
42
- scheduled_start_time DateTime?
43
- scheduled_end_time DateTime?
44
- actual_start_time DateTime?
45
- actual_end_time DateTime?
42
+ interview_summary String[]
43
+ scheduled_start_time DateTime?
44
+ scheduled_end_time DateTime?
45
+ actual_start_time DateTime?
46
+ actual_end_time DateTime?
46
47
  /// Interview length in minutes (source of truth; not derived from schedule window).
47
- duration Int?
48
+ duration Int?
48
49
  /// @deprecated Prefer `recording_document_id` + `Document` (type INTERVIEW_RECORDING).
49
- recording_url String?
50
- recording_document_id String? @unique
51
- evaluation_type EvaluationType? @default(TREADSPACE_AI_ASSISTED)
52
- ai_assistance_mode AiAssistanceMode? @default(ASSISTED)
53
- interview_status InterviewStatus @default(SCHEDULED)
54
- interview_platform InterviewPlatform @default(TREADSPACE)
55
- overall_feedback String?
50
+ recording_url String?
51
+ recording_document_id String? @unique
52
+ evaluation_type EvaluationType? @default(TREADSPACE_AI_ASSISTED)
53
+ ai_assistance_mode AiAssistanceMode? @default(ASSISTED)
54
+ interview_status InterviewStatus @default(SCHEDULED)
55
+ interview_platform InterviewPlatform @default(TREADSPACE)
56
+ overall_feedback String?
56
57
  /// Feedback JSON fields
57
58
  /// AI overall payload: `{ score, rating, feedback? }` where `feedback` is the
58
59
  /// narrative summary string (replaces deprecated `interview_summary`).
59
- ai_feedback Json?
60
- human_feedback Json?
61
- section_feedback Json[]
62
- interview_preparation Json?
63
- final_feedback Json?
64
- interview_analysis_ranges Json?
65
- interview_flow_summary String?
60
+ ai_feedback Json?
61
+ human_feedback Json?
62
+ section_feedback Json[]
63
+ interview_preparation Json?
64
+ final_feedback Json?
65
+ interview_analysis_ranges Json?
66
+ interview_flow_summary String?
66
67
  /// When Orion AI feedback was last persisted on this interview.
67
- ai_feedback_generated_at DateTime?
68
+ ai_feedback_generated_at DateTime?
68
69
  /// Experimental Beta AI feedback store (parallel to production AI columns).
69
70
  /// Used by Beta Feedback page so regenerating AI does not overwrite production.
70
- beta_ai_feedback Json?
71
- beta_section_feedback Json[] @default([])
72
- beta_final_feedback Json?
73
- beta_interview_flow_summary String?
74
- beta_ai_feedback_generated_at DateTime?
71
+ beta_ai_feedback Json?
72
+ beta_section_feedback Json[] @default([])
73
+ beta_final_feedback Json?
74
+ beta_interview_flow_summary String?
75
+ beta_ai_feedback_generated_at DateTime?
75
76
  /// When recruiter human feedback was last saved (draft or final).
76
- human_feedback_updated_at DateTime?
77
+ human_feedback_updated_at DateTime?
77
78
  /// When final human feedback was submitted.
78
- evaluated_at DateTime?
79
+ evaluated_at DateTime?
79
80
 
80
81
  /// Self-scheduling
81
82
  reschedule_count Int @default(0)
@@ -1,10 +1,12 @@
1
- /// Immutable assignment history for Hiring Unit department/job changes.
1
+ /// Immutable assignment history for Hiring Unit department/user/job changes.
2
2
  model PurchasedHiringUnitAssignmentEvent {
3
3
  id String @id @default(uuid())
4
4
  purchased_hiring_unit_id String
5
5
  event_kind PurchasedHiringUnitAssignmentEventKind
6
6
  previous_department_id String?
7
7
  new_department_id String?
8
+ previous_assigned_user_id String?
9
+ new_assigned_user_id String?
8
10
  previous_job_description_id String?
9
11
  new_job_description_id String?
10
12
  effective_at DateTime @default(now())
@@ -34,6 +34,8 @@ enum PurchasedTopUpStatus {
34
34
  enum PurchasedHiringUnitAssignmentEventKind {
35
35
  DEPARTMENT_ASSIGNED
36
36
  DEPARTMENT_UNASSIGNED
37
+ USER_ASSIGNED
38
+ USER_UNASSIGNED
37
39
  JOB_LINKED
38
40
  JOB_UNLINKED
39
41
 
@@ -41,6 +41,8 @@ model PurchasedHiringUnit {
41
41
  status PurchasedHiringUnitStatus @default(AVAILABLE)
42
42
  /// Current department allocation (licensing allocation, not hiring manager).
43
43
  department_id String?
44
+ /// Optional person reservation. Units with this set are consumed before dept/org pools.
45
+ assigned_user_id String?
44
46
  /// Set once when department_id is first assigned; not cleared on reassignment.
45
47
  first_assigned_at DateTime?
46
48
  /// Optional unit expiry.
@@ -57,6 +59,7 @@ model PurchasedHiringUnit {
57
59
  organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
58
60
  purchased_license_package PurchasedLicensePackage @relation(fields: [purchased_license_package_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
59
61
  department Department? @relation(fields: [department_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
62
+ assigned_user User? @relation("AssignedHiringUnits", fields: [assigned_user_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
60
63
  job_description JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
61
64
  assignment_events PurchasedHiringUnitAssignmentEvent[]
62
65
  ledger_entries LicensingLedgerEntry[]
@@ -65,9 +68,11 @@ model PurchasedHiringUnit {
65
68
  @@index([organisation_id])
66
69
  @@index([purchased_license_package_id])
67
70
  @@index([department_id])
71
+ @@index([assigned_user_id])
68
72
  @@index([job_description_id])
69
73
  @@index([organisation_id, status])
70
74
  @@index([organisation_id, department_id])
75
+ @@index([organisation_id, assigned_user_id])
71
76
  @@index([organisation_id, job_description_id])
72
77
  @@map("purchased_hiring_units")
73
78
  @@schema("licensing")
@@ -0,0 +1,38 @@
1
+ -- Org policy for who may consume unused hiring units, plus optional user
2
+ -- reservation on each hiring unit. No row rewrite / backfill: existing units
3
+ -- stay department-only (assigned_user_id NULL). Scope default DEPARTMENT
4
+ -- matches current assign-to-department behaviour.
5
+
6
+ -- CreateEnum
7
+ CREATE TYPE "public"."HiringUnitAssignmentScope" AS ENUM ('USER', 'DEPARTMENT', 'ORGANISATION');
8
+
9
+ -- AlterTable
10
+ ALTER TABLE "Organisation"
11
+ ADD COLUMN "hiring_unit_assignment_scope" "public"."HiringUnitAssignmentScope" NOT NULL DEFAULT 'DEPARTMENT';
12
+
13
+ -- AlterEnum
14
+ -- Postgres 12+ permits ADD VALUE inside the migration transaction as long as
15
+ -- the new value is not also used there.
16
+ ALTER TYPE "licensing"."PurchasedHiringUnitAssignmentEventKind" ADD VALUE 'USER_ASSIGNED';
17
+ ALTER TYPE "licensing"."PurchasedHiringUnitAssignmentEventKind" ADD VALUE 'USER_UNASSIGNED';
18
+
19
+ -- AlterTable
20
+ ALTER TABLE "licensing"."purchased_hiring_units"
21
+ ADD COLUMN "assigned_user_id" TEXT;
22
+
23
+ ALTER TABLE "licensing"."purchased_hiring_unit_assignment_events"
24
+ ADD COLUMN "previous_assigned_user_id" TEXT,
25
+ ADD COLUMN "new_assigned_user_id" TEXT;
26
+
27
+ -- CreateIndex
28
+ CREATE INDEX "purchased_hiring_units_assigned_user_id_idx"
29
+ ON "licensing"."purchased_hiring_units"("assigned_user_id");
30
+
31
+ CREATE INDEX "purchased_hiring_units_organisation_id_assigned_user_id_idx"
32
+ ON "licensing"."purchased_hiring_units"("organisation_id", "assigned_user_id");
33
+
34
+ -- AddForeignKey
35
+ ALTER TABLE "licensing"."purchased_hiring_units"
36
+ ADD CONSTRAINT "purchased_hiring_units_assigned_user_id_fkey"
37
+ FOREIGN KEY ("assigned_user_id") REFERENCES "User"("id")
38
+ ON DELETE SET NULL ON UPDATE CASCADE;
@@ -8,6 +8,15 @@ enum OrganisationSize {
8
8
  @@schema("public")
9
9
  }
10
10
 
11
+ /// Who may consume unused hiring units. Changing this does not rewrite unit rows.
12
+ enum HiringUnitAssignmentScope {
13
+ USER
14
+ DEPARTMENT
15
+ ORGANISATION
16
+
17
+ @@schema("public")
18
+ }
19
+
11
20
  model Organisation {
12
21
  id String @id @default(uuid())
13
22
  name String @unique
@@ -50,6 +59,8 @@ model Organisation {
50
59
  timezone String @default("Asia/Kolkata")
51
60
  /// ISO 3166-1 alpha-2 (e.g. IN).
52
61
  country_code String @default("IN")
62
+ /// Who may consume unused hiring units. Does not rewrite unit rows when changed.
63
+ hiring_unit_assignment_scope HiringUnitAssignmentScope @default(DEPARTMENT)
53
64
  organisation_configs OrganisationConfig[]
54
65
  activity_events ActivityEvent[]
55
66
  usage_ledger_entries UsageLedgerEntry[]
@@ -100,7 +100,8 @@ model User {
100
100
  employee_number Int?
101
101
  employee_code String? @unique
102
102
 
103
- department_members DepartmentMember[] @relation("DepartmentMemberships")
103
+ department_members DepartmentMember[] @relation("DepartmentMemberships")
104
+ assigned_hiring_units PurchasedHiringUnit[] @relation("AssignedHiringUnits")
104
105
 
105
106
  @@index([role_id])
106
107
  @@index([permission_id])