@adaptware/eagles-db 0.6.22 → 0.6.23

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.6.22",
3
+ "version": "0.6.23",
4
4
  "description": "A Prisma client package for Treadspace database operations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -93,6 +93,7 @@ model Interview {
93
93
  /// Candidate invite response (legal consent in ConsentRecord).
94
94
  candidate_status String? @default("INVITED")
95
95
  candidate_responded_at DateTime?
96
+ decline_reason String?
96
97
  /// When this timestamp moves forward, prior INTERVIEW_SESSION consent grants are stale.
97
98
  consent_epoch_at DateTime @default(now())
98
99
 
@@ -11,6 +11,8 @@ model LicensePackage {
11
11
  cost_price Decimal @default(0) @db.Decimal(18, 2)
12
12
  currency String @default("INR")
13
13
  status LicensePackageStatus @default(DRAFT)
14
+ /// REGULAR creates hiring units. TOP_UP is inventory assigned later.
15
+ product_type LicenseProductType @default(REGULAR)
14
16
  /// Number of PurchasedHiringUnit rows created per package purchase.
15
17
  units_per_purchase Int
16
18
 
@@ -30,6 +32,7 @@ model LicensePackage {
30
32
  is_active Boolean @default(true)
31
33
 
32
34
  purchased_license_packages PurchasedLicensePackage[]
35
+ purchased_top_ups PurchasedTopUp[]
33
36
  organisations LicensePackageOrganisation[]
34
37
 
35
38
  @@unique([code, version])
@@ -6,6 +6,13 @@ enum LicensePackageStatus {
6
6
  @@schema("licensing")
7
7
  }
8
8
 
9
+ enum LicenseProductType {
10
+ REGULAR
11
+ TOP_UP
12
+
13
+ @@schema("licensing")
14
+ }
15
+
9
16
  enum PurchasedLicensePackageStatus {
10
17
  ACTIVE
11
18
  EXPIRED
@@ -23,14 +30,6 @@ enum PurchasedHiringUnitStatus {
23
30
  @@schema("licensing")
24
31
  }
25
32
 
26
- enum PurchasedTopUpStatus {
27
- ACTIVE
28
- DEPLETED
29
- CANCELLED
30
-
31
- @@schema("licensing")
32
- }
33
-
34
33
  enum PurchasedHiringUnitAssignmentEventKind {
35
34
  DEPARTMENT_ASSIGNED
36
35
  DEPARTMENT_UNASSIGNED
@@ -74,6 +73,7 @@ enum LicensingLedgerReason {
74
73
 
75
74
  enum AiCostLedgerReason {
76
75
  PURCHASE
76
+ TOP_UP
77
77
  USAGE
78
78
  ADJUSTMENT
79
79
  REFUND
@@ -67,6 +67,7 @@ model PurchasedHiringUnit {
67
67
  assignment_events PurchasedHiringUnitAssignmentEvent[]
68
68
  ledger_entries LicensingLedgerEntry[]
69
69
  ai_cost_ledger_entries AiCostLedgerEntry[]
70
+ purchased_top_ups PurchasedTopUp[]
70
71
 
71
72
  @@index([organisation_id])
72
73
  @@index([purchased_license_package_id])
@@ -1,28 +1,19 @@
1
- /// Wide top-up purchase: org-level per-metric pool (purchased / remaining) before allocation to hiring units.
1
+ /// Commercial top-up inventory. Directly assigned to a hiring unit upon purchase.
2
+ /// Purchase credits `licensing.licensing_ledger` and `licensing.ai_cost_ledger`
3
+ /// for the linked hiring unit in a single atomic transaction.
4
+ /// Display entitlements and product name come from `license_package_id`.
2
5
  model PurchasedTopUp {
3
- id String @id @default(uuid())
4
- organisation_id String
5
- purchased_at DateTime @default(now())
6
- status PurchasedTopUpStatus @default(ACTIVE)
7
- total_price Decimal? @db.Decimal(18, 2)
8
- currency String? @default("INR")
9
- description String?
6
+ id String @id @default(uuid())
7
+ organisation_id String
8
+ license_package_id String
9
+ /// Directly assigned to exactly one hiring unit at purchase time.
10
+ purchased_hiring_unit_id String
10
11
 
11
- interview_ai_assisted_hours_purchased Decimal? @db.Decimal(20, 4)
12
- interview_full_ai_hours_purchased Decimal? @db.Decimal(20, 4)
13
- interview_non_ai_hours_purchased Decimal? @db.Decimal(20, 4)
14
- assignment_count_purchased Decimal? @db.Decimal(20, 4)
15
- test_count_purchased Decimal? @db.Decimal(20, 4)
16
- resume_count_purchased Decimal? @db.Decimal(20, 4)
17
- credits_purchased Decimal? @db.Decimal(20, 4)
18
-
19
- interview_ai_assisted_hours_remaining Decimal? @db.Decimal(20, 4)
20
- interview_full_ai_hours_remaining Decimal? @db.Decimal(20, 4)
21
- interview_non_ai_hours_remaining Decimal? @db.Decimal(20, 4)
22
- assignment_count_remaining Decimal? @db.Decimal(20, 4)
23
- test_count_remaining Decimal? @db.Decimal(20, 4)
24
- resume_count_remaining Decimal? @db.Decimal(20, 4)
25
- credits_remaining Decimal? @db.Decimal(20, 4)
12
+ total_price Decimal @db.Decimal(18, 2)
13
+ currency String @default("INR")
14
+ purchased_at DateTime @default(now())
15
+ /// Reserved for a later expiry policy. Null means no expiry. V1 does not enforce it.
16
+ expires_at DateTime?
26
17
 
27
18
  created_at DateTime @default(now())
28
19
  updated_at DateTime @updatedAt
@@ -30,10 +21,12 @@ model PurchasedTopUp {
30
21
  updated_by String
31
22
  is_active Boolean @default(true)
32
23
 
33
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
24
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
25
+ license_package LicensePackage @relation(fields: [license_package_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
26
+ purchased_hiring_unit PurchasedHiringUnit @relation(fields: [purchased_hiring_unit_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
34
27
 
35
28
  @@index([organisation_id])
36
- @@index([organisation_id, status])
29
+ @@index([purchased_hiring_unit_id])
37
30
  @@map("purchased_top_ups")
38
31
  @@schema("licensing")
39
32
  }