@adaptware/eagles-db 0.5.39 → 0.5.40
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/client/edge.js +231 -5
- package/client/index-browser.js +228 -2
- package/client/index.d.ts +107666 -86251
- package/client/index.js +231 -5
- package/client/package.json +1 -1
- package/client/schema.prisma +457 -96
- package/client/wasm.js +231 -5
- package/package.json +1 -1
- package/prisma/schema/jobApplicationFields.prisma +19 -15
- package/prisma/schema/jobApplicationResponse.prisma +7 -5
package/client/package.json
CHANGED
package/client/schema.prisma
CHANGED
|
@@ -1284,24 +1284,25 @@ enum HiringPlanSectionStatus {
|
|
|
1284
1284
|
/// Replaces the free-text `business_unit` string on HiringPlanLine / Employee.
|
|
1285
1285
|
/// Headship lives on DepartmentMember.is_head (at most one per dept, enforced in service).
|
|
1286
1286
|
model Department {
|
|
1287
|
-
id
|
|
1288
|
-
organisation_id
|
|
1289
|
-
name
|
|
1290
|
-
code
|
|
1287
|
+
id String @id @default(uuid())
|
|
1288
|
+
organisation_id String
|
|
1289
|
+
name String
|
|
1290
|
+
code String?
|
|
1291
1291
|
/// Global display order across departments within the org (drag-reorder in plan grid).
|
|
1292
|
-
sort_order
|
|
1293
|
-
created_at
|
|
1294
|
-
updated_at
|
|
1295
|
-
created_by
|
|
1296
|
-
updated_by
|
|
1297
|
-
is_active
|
|
1298
|
-
organisation
|
|
1299
|
-
members
|
|
1300
|
-
hiring_plan_lines
|
|
1301
|
-
employees
|
|
1302
|
-
job_descriptions
|
|
1303
|
-
job_profiles
|
|
1304
|
-
sections
|
|
1292
|
+
sort_order Int @default(0)
|
|
1293
|
+
created_at DateTime @default(now())
|
|
1294
|
+
updated_at DateTime @updatedAt
|
|
1295
|
+
created_by String
|
|
1296
|
+
updated_by String
|
|
1297
|
+
is_active Boolean @default(true)
|
|
1298
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1299
|
+
members DepartmentMember[]
|
|
1300
|
+
hiring_plan_lines HiringPlanLine[]
|
|
1301
|
+
employees Employee[]
|
|
1302
|
+
job_descriptions JobDescription[]
|
|
1303
|
+
job_profiles JobProfile[]
|
|
1304
|
+
sections HiringPlanSection[]
|
|
1305
|
+
assigned_hiring_units PurchasedHiringUnit[]
|
|
1305
1306
|
|
|
1306
1307
|
@@unique([organisation_id, name])
|
|
1307
1308
|
@@index([organisation_id])
|
|
@@ -2369,30 +2370,34 @@ enum JobApplicationFieldType {
|
|
|
2369
2370
|
|
|
2370
2371
|
model JobApplicationField {
|
|
2371
2372
|
/// Primary key (UUID)
|
|
2372
|
-
id
|
|
2373
|
+
id String @id @default(uuid())
|
|
2373
2374
|
/// Foreign keys
|
|
2374
|
-
organisation_id
|
|
2375
|
-
template_id
|
|
2375
|
+
organisation_id String
|
|
2376
|
+
template_id String
|
|
2376
2377
|
/// Data fields
|
|
2377
|
-
field_type
|
|
2378
|
-
label
|
|
2379
|
-
description
|
|
2380
|
-
is_mandatory
|
|
2381
|
-
is_draft
|
|
2382
|
-
options
|
|
2378
|
+
field_type JobApplicationFieldType
|
|
2379
|
+
label String
|
|
2380
|
+
description String?
|
|
2381
|
+
is_mandatory Boolean @default(false)
|
|
2382
|
+
is_draft Boolean @default(true)
|
|
2383
|
+
options String[]
|
|
2383
2384
|
/// Audit fields
|
|
2384
|
-
is_active
|
|
2385
|
-
created_by
|
|
2386
|
-
updated_by
|
|
2387
|
-
created_at
|
|
2388
|
-
updated_at
|
|
2385
|
+
is_active Boolean @default(true)
|
|
2386
|
+
created_by String
|
|
2387
|
+
updated_by String
|
|
2388
|
+
created_at DateTime @default(now())
|
|
2389
|
+
updated_at DateTime @updatedAt
|
|
2390
|
+
|
|
2391
|
+
/// order of question
|
|
2392
|
+
order_no Int? //nullable for now to allow migration
|
|
2393
|
+
|
|
2389
2394
|
/// Relations
|
|
2390
2395
|
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
2391
2396
|
job_application_template JobApplicationTemplate @relation(fields: [template_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
2392
2397
|
job_application_responses JobApplicationResponse[]
|
|
2393
2398
|
|
|
2394
2399
|
/// Indexes
|
|
2395
|
-
@@index([organisation_id, template_id])
|
|
2400
|
+
@@index([organisation_id, template_id, order_no])
|
|
2396
2401
|
@@schema("public")
|
|
2397
2402
|
}
|
|
2398
2403
|
|
|
@@ -2420,13 +2425,15 @@ model JobApplicationResponse {
|
|
|
2420
2425
|
created_by String
|
|
2421
2426
|
updated_by String
|
|
2422
2427
|
is_active Boolean @default(true)
|
|
2428
|
+
order_no Int? //nullable for now to allow migration
|
|
2429
|
+
|
|
2423
2430
|
/// Relations
|
|
2424
|
-
application
|
|
2425
|
-
field
|
|
2426
|
-
document
|
|
2431
|
+
application Application @relation(fields: [application_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
2432
|
+
field JobApplicationField? @relation(fields: [job_application_field_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2433
|
+
document Document? @relation(fields: [document_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
2427
2434
|
|
|
2428
|
-
|
|
2429
|
-
@@index([application_id])
|
|
2435
|
+
// / Partial unique on (application_id, job_application_field_id) WHERE job_application_field_id IS NOT NULL — see migration SQL
|
|
2436
|
+
@@index([application_id, is_active, order_no])
|
|
2430
2437
|
@@index([job_application_field_id])
|
|
2431
2438
|
@@schema("public")
|
|
2432
2439
|
}
|
|
@@ -2539,6 +2546,7 @@ model JobDescription {
|
|
|
2539
2546
|
hiring_plan_line HiringPlanLine? @relation("PlanLineRequisitions", fields: [hiring_plan_line_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
2540
2547
|
/// Plan lines that use this JD as the role template/reference.
|
|
2541
2548
|
referenced_by_plan_lines HiringPlanLine[] @relation("PlanLineTemplateJd")
|
|
2549
|
+
linked_hiring_units PurchasedHiringUnit[]
|
|
2542
2550
|
|
|
2543
2551
|
@@index([organisation_id])
|
|
2544
2552
|
@@index([hiring_manager_id])
|
|
@@ -2730,6 +2738,353 @@ model JobRoundAnalyticsDaily {
|
|
|
2730
2738
|
@@schema("analytics")
|
|
2731
2739
|
}
|
|
2732
2740
|
|
|
2741
|
+
/// Append-only book of AI workflow cost (org pool, optionally a hiring unit).
|
|
2742
|
+
/// Covers every workflow (including license-included names). Amount is always USD.
|
|
2743
|
+
/// total_cost(unit) = SUM(DEBIT amount) - SUM(CREDIT amount) for that unit.
|
|
2744
|
+
/// CREDIT / PURCHASE is full package internal cost (USD) per hiring unit.
|
|
2745
|
+
/// DEBIT / USAGE is every workflow's Orion totalCost (USD), nothing excluded.
|
|
2746
|
+
model AiCostLedgerEntry {
|
|
2747
|
+
id String @id @default(uuid())
|
|
2748
|
+
organisation_id String
|
|
2749
|
+
purchased_hiring_unit_id String?
|
|
2750
|
+
workflow_name String
|
|
2751
|
+
direction LicensingLedgerDirection
|
|
2752
|
+
/// Always non-negative. USD.
|
|
2753
|
+
amount Decimal @db.Decimal(20, 4)
|
|
2754
|
+
reason AiCostLedgerReason
|
|
2755
|
+
occurred_at DateTime @default(now())
|
|
2756
|
+
source_type String?
|
|
2757
|
+
source_id String?
|
|
2758
|
+
description String?
|
|
2759
|
+
idempotency_key String @unique
|
|
2760
|
+
created_at DateTime @default(now())
|
|
2761
|
+
updated_at DateTime @default(now()) @updatedAt
|
|
2762
|
+
created_by String
|
|
2763
|
+
updated_by String
|
|
2764
|
+
is_active Boolean @default(true)
|
|
2765
|
+
|
|
2766
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2767
|
+
purchased_hiring_unit PurchasedHiringUnit? @relation(fields: [purchased_hiring_unit_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2768
|
+
|
|
2769
|
+
@@index([purchased_hiring_unit_id, occurred_at], map: "ai_cost_ledger_unit_occurred_idx")
|
|
2770
|
+
@@index([purchased_hiring_unit_id, workflow_name, occurred_at], map: "ai_cost_ledger_unit_workflow_occurred_idx")
|
|
2771
|
+
@@index([organisation_id, occurred_at], map: "ai_cost_ledger_org_occurred_idx")
|
|
2772
|
+
@@map("ai_cost_ledger")
|
|
2773
|
+
@@schema("licensing")
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
/// Immutable assignment history for Hiring Unit department/job changes.
|
|
2777
|
+
model PurchasedHiringUnitAssignmentEvent {
|
|
2778
|
+
id String @id @default(uuid())
|
|
2779
|
+
purchased_hiring_unit_id String
|
|
2780
|
+
event_kind PurchasedHiringUnitAssignmentEventKind
|
|
2781
|
+
previous_department_id String?
|
|
2782
|
+
new_department_id String?
|
|
2783
|
+
previous_job_description_id String?
|
|
2784
|
+
new_job_description_id String?
|
|
2785
|
+
effective_at DateTime @default(now())
|
|
2786
|
+
created_by String
|
|
2787
|
+
|
|
2788
|
+
purchased_hiring_unit PurchasedHiringUnit @relation(fields: [purchased_hiring_unit_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2789
|
+
|
|
2790
|
+
@@index([purchased_hiring_unit_id], map: "purchased_hu_assignment_events_unit_id_idx")
|
|
2791
|
+
@@index([purchased_hiring_unit_id, effective_at], map: "purchased_hu_assignment_events_unit_effective_idx")
|
|
2792
|
+
@@map("purchased_hiring_unit_assignment_events")
|
|
2793
|
+
@@schema("licensing")
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
/// Product catalogue: one wide row per (code, version) with fixed per-hiring-unit entitlements.
|
|
2797
|
+
/// See eagles-db/docs/eagles-db/licensing-catalog.md for column → usage metric_key mapping at purchase.
|
|
2798
|
+
model LicensePackage {
|
|
2799
|
+
id String @id @default(uuid())
|
|
2800
|
+
code String
|
|
2801
|
+
version Int
|
|
2802
|
+
name String
|
|
2803
|
+
description String?
|
|
2804
|
+
price Decimal @db.Decimal(18, 2)
|
|
2805
|
+
/// Internal cost of the package. Same currency as `currency`. Not for org-facing catalogue APIs.
|
|
2806
|
+
cost_price Decimal @default(0) @db.Decimal(18, 2)
|
|
2807
|
+
currency String @default("INR")
|
|
2808
|
+
status LicensePackageStatus @default(DRAFT)
|
|
2809
|
+
/// Number of PurchasedHiringUnit rows created per package purchase.
|
|
2810
|
+
units_per_purchase Int
|
|
2811
|
+
|
|
2812
|
+
/// Per-hiring-unit entitlements. null = not included; 0 = explicitly zero.
|
|
2813
|
+
interview_ai_assisted_hours Decimal? @db.Decimal(20, 4)
|
|
2814
|
+
interview_full_ai_hours Decimal? @db.Decimal(20, 4)
|
|
2815
|
+
interview_non_ai_hours Decimal? @db.Decimal(20, 4)
|
|
2816
|
+
assignment_count Decimal? @db.Decimal(20, 4)
|
|
2817
|
+
test_count Decimal? @db.Decimal(20, 4)
|
|
2818
|
+
resume_count Decimal? @db.Decimal(20, 4)
|
|
2819
|
+
credits Decimal? @db.Decimal(20, 4)
|
|
2820
|
+
|
|
2821
|
+
created_at DateTime @default(now())
|
|
2822
|
+
updated_at DateTime @updatedAt
|
|
2823
|
+
created_by String
|
|
2824
|
+
updated_by String
|
|
2825
|
+
is_active Boolean @default(true)
|
|
2826
|
+
|
|
2827
|
+
purchased_license_packages PurchasedLicensePackage[]
|
|
2828
|
+
organisations LicensePackageOrganisation[]
|
|
2829
|
+
|
|
2830
|
+
@@unique([code, version])
|
|
2831
|
+
@@index([code])
|
|
2832
|
+
@@index([status])
|
|
2833
|
+
@@map("license_packages")
|
|
2834
|
+
@@schema("licensing")
|
|
2835
|
+
}
|
|
2836
|
+
|
|
2837
|
+
/// Many-to-many: which organisations may see this catalogue package.
|
|
2838
|
+
/// Zero rows = visible to nobody except platform list (enforced later in eagles-backend).
|
|
2839
|
+
model LicensePackageOrganisation {
|
|
2840
|
+
id String @id @default(uuid())
|
|
2841
|
+
license_package_id String
|
|
2842
|
+
organisation_id String
|
|
2843
|
+
|
|
2844
|
+
created_at DateTime @default(now())
|
|
2845
|
+
updated_at DateTime @updatedAt
|
|
2846
|
+
created_by String
|
|
2847
|
+
updated_by String
|
|
2848
|
+
is_active Boolean @default(true)
|
|
2849
|
+
|
|
2850
|
+
license_package LicensePackage @relation(fields: [license_package_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2851
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2852
|
+
|
|
2853
|
+
@@unique([license_package_id, organisation_id], map: "license_package_orgs_pkg_org_key")
|
|
2854
|
+
@@index([organisation_id])
|
|
2855
|
+
@@map("license_package_organisations")
|
|
2856
|
+
@@schema("licensing")
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2859
|
+
enum LicensePackageStatus {
|
|
2860
|
+
DRAFT
|
|
2861
|
+
ACTIVE
|
|
2862
|
+
ARCHIVED
|
|
2863
|
+
|
|
2864
|
+
@@schema("licensing")
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
enum PurchasedLicensePackageStatus {
|
|
2868
|
+
ACTIVE
|
|
2869
|
+
EXPIRED
|
|
2870
|
+
CANCELLED
|
|
2871
|
+
|
|
2872
|
+
@@schema("licensing")
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2875
|
+
enum PurchasedHiringUnitStatus {
|
|
2876
|
+
AVAILABLE
|
|
2877
|
+
ASSIGNED
|
|
2878
|
+
ACTIVE
|
|
2879
|
+
EXPIRED
|
|
2880
|
+
|
|
2881
|
+
@@schema("licensing")
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
enum PurchasedTopUpStatus {
|
|
2885
|
+
ACTIVE
|
|
2886
|
+
DEPLETED
|
|
2887
|
+
CANCELLED
|
|
2888
|
+
|
|
2889
|
+
@@schema("licensing")
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2892
|
+
enum PurchasedHiringUnitAssignmentEventKind {
|
|
2893
|
+
DEPARTMENT_ASSIGNED
|
|
2894
|
+
DEPARTMENT_UNASSIGNED
|
|
2895
|
+
JOB_LINKED
|
|
2896
|
+
JOB_UNLINKED
|
|
2897
|
+
|
|
2898
|
+
@@schema("licensing")
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
enum LicensingLedgerEntitlementType {
|
|
2902
|
+
INTERVIEW_AI_ASSISTED_HOURS
|
|
2903
|
+
INTERVIEW_FULL_AI_HOURS
|
|
2904
|
+
INTERVIEW_NON_AI_HOURS
|
|
2905
|
+
ASSIGNMENT_COUNT
|
|
2906
|
+
TEST_COUNT
|
|
2907
|
+
RESUME_COUNT
|
|
2908
|
+
CREDITS
|
|
2909
|
+
|
|
2910
|
+
@@schema("licensing")
|
|
2911
|
+
}
|
|
2912
|
+
|
|
2913
|
+
enum LicensingLedgerDirection {
|
|
2914
|
+
CREDIT
|
|
2915
|
+
DEBIT
|
|
2916
|
+
|
|
2917
|
+
@@schema("licensing")
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
enum LicensingLedgerReason {
|
|
2921
|
+
PURCHASE
|
|
2922
|
+
TOP_UP
|
|
2923
|
+
USAGE
|
|
2924
|
+
ADJUSTMENT
|
|
2925
|
+
REFUND
|
|
2926
|
+
EXPIRY
|
|
2927
|
+
|
|
2928
|
+
@@schema("licensing")
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
enum AiCostLedgerReason {
|
|
2932
|
+
PURCHASE
|
|
2933
|
+
USAGE
|
|
2934
|
+
ADJUSTMENT
|
|
2935
|
+
REFUND
|
|
2936
|
+
|
|
2937
|
+
@@schema("licensing")
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
/// Append-only book of hiring-unit entitlement movements.
|
|
2941
|
+
/// remaining(unit, type) = SUM(CREDIT amount) - SUM(DEBIT amount).
|
|
2942
|
+
/// See eagles-db/docs/eagles-db/licensing-hiring-unit.md.
|
|
2943
|
+
model LicensingLedgerEntry {
|
|
2944
|
+
id String @id @default(uuid())
|
|
2945
|
+
organisation_id String
|
|
2946
|
+
/// Null for org-level rows (e.g. unallocated top-ups later).
|
|
2947
|
+
purchased_hiring_unit_id String?
|
|
2948
|
+
entitlement_type LicensingLedgerEntitlementType
|
|
2949
|
+
direction LicensingLedgerDirection
|
|
2950
|
+
/// Always non-negative. CREDIT of 0 means the stem is included at zero.
|
|
2951
|
+
amount Decimal @db.Decimal(20, 4)
|
|
2952
|
+
reason LicensingLedgerReason
|
|
2953
|
+
occurred_at DateTime @default(now())
|
|
2954
|
+
source_type String?
|
|
2955
|
+
source_id String?
|
|
2956
|
+
description String?
|
|
2957
|
+
idempotency_key String @unique
|
|
2958
|
+
created_at DateTime @default(now())
|
|
2959
|
+
updated_at DateTime @default(now()) @updatedAt
|
|
2960
|
+
created_by String
|
|
2961
|
+
updated_by String
|
|
2962
|
+
is_active Boolean @default(true)
|
|
2963
|
+
|
|
2964
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2965
|
+
purchased_hiring_unit PurchasedHiringUnit? @relation(fields: [purchased_hiring_unit_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2966
|
+
|
|
2967
|
+
@@index([purchased_hiring_unit_id, entitlement_type, occurred_at], map: "licensing_ledger_unit_type_occurred_idx")
|
|
2968
|
+
@@index([organisation_id, entitlement_type, occurred_at], map: "licensing_ledger_org_type_occurred_idx")
|
|
2969
|
+
@@map("licensing_ledger")
|
|
2970
|
+
@@schema("licensing")
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
/// Historical package purchase by an organisation (independent per transaction).
|
|
2974
|
+
model PurchasedLicensePackage {
|
|
2975
|
+
id String @id @default(uuid())
|
|
2976
|
+
organisation_id String
|
|
2977
|
+
license_package_id String
|
|
2978
|
+
/// Snapshot of catalogue identity at purchase time.
|
|
2979
|
+
package_code String
|
|
2980
|
+
package_version Int
|
|
2981
|
+
package_name String
|
|
2982
|
+
price Decimal @db.Decimal(18, 2)
|
|
2983
|
+
currency String @default("INR")
|
|
2984
|
+
units_per_purchase Int
|
|
2985
|
+
/// How many package instances were bought in this transaction.
|
|
2986
|
+
package_quantity Int @default(1)
|
|
2987
|
+
purchased_at DateTime @default(now())
|
|
2988
|
+
status PurchasedLicensePackageStatus @default(ACTIVE)
|
|
2989
|
+
created_at DateTime @default(now())
|
|
2990
|
+
updated_at DateTime @updatedAt
|
|
2991
|
+
created_by String
|
|
2992
|
+
updated_by String
|
|
2993
|
+
is_active Boolean @default(true)
|
|
2994
|
+
|
|
2995
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2996
|
+
license_package LicensePackage @relation(fields: [license_package_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2997
|
+
hiring_units PurchasedHiringUnit[]
|
|
2998
|
+
|
|
2999
|
+
@@index([organisation_id])
|
|
3000
|
+
@@index([organisation_id, status])
|
|
3001
|
+
@@index([organisation_id, purchased_at])
|
|
3002
|
+
@@map("purchased_license_packages")
|
|
3003
|
+
@@schema("licensing")
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
/// Runtime hiring unit identity and allocation. Entitlement balances live on
|
|
3007
|
+
/// `licensing.licensing_ledger` (Prisma model `LicensingLedgerEntry`).
|
|
3008
|
+
/// See eagles-db/docs/eagles-db/licensing-hiring-unit.md.
|
|
3009
|
+
model PurchasedHiringUnit {
|
|
3010
|
+
id String @id @default(uuid())
|
|
3011
|
+
organisation_id String
|
|
3012
|
+
purchased_license_package_id String
|
|
3013
|
+
status PurchasedHiringUnitStatus @default(AVAILABLE)
|
|
3014
|
+
/// Current department allocation (licensing allocation, not hiring manager).
|
|
3015
|
+
department_id String?
|
|
3016
|
+
/// Set once when department_id is first assigned; not cleared on reassignment.
|
|
3017
|
+
first_assigned_at DateTime?
|
|
3018
|
+
/// Optional unit expiry.
|
|
3019
|
+
expiry_at DateTime?
|
|
3020
|
+
/// Optional job association (distinct from JobDescription.hiring_manager_id).
|
|
3021
|
+
job_description_id String?
|
|
3022
|
+
|
|
3023
|
+
created_at DateTime @default(now())
|
|
3024
|
+
updated_at DateTime @updatedAt
|
|
3025
|
+
created_by String
|
|
3026
|
+
updated_by String
|
|
3027
|
+
is_active Boolean @default(true)
|
|
3028
|
+
|
|
3029
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3030
|
+
purchased_license_package PurchasedLicensePackage @relation(fields: [purchased_license_package_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3031
|
+
department Department? @relation(fields: [department_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
3032
|
+
job_description JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
3033
|
+
assignment_events PurchasedHiringUnitAssignmentEvent[]
|
|
3034
|
+
ledger_entries LicensingLedgerEntry[]
|
|
3035
|
+
ai_cost_ledger_entries AiCostLedgerEntry[]
|
|
3036
|
+
|
|
3037
|
+
@@index([organisation_id])
|
|
3038
|
+
@@index([purchased_license_package_id])
|
|
3039
|
+
@@index([department_id])
|
|
3040
|
+
@@index([job_description_id])
|
|
3041
|
+
@@index([organisation_id, status])
|
|
3042
|
+
@@index([organisation_id, department_id])
|
|
3043
|
+
@@index([organisation_id, job_description_id])
|
|
3044
|
+
@@map("purchased_hiring_units")
|
|
3045
|
+
@@schema("licensing")
|
|
3046
|
+
}
|
|
3047
|
+
|
|
3048
|
+
/// Wide top-up purchase: org-level per-metric pool (purchased / remaining) before allocation to hiring units.
|
|
3049
|
+
model PurchasedTopUp {
|
|
3050
|
+
id String @id @default(uuid())
|
|
3051
|
+
organisation_id String
|
|
3052
|
+
purchased_at DateTime @default(now())
|
|
3053
|
+
status PurchasedTopUpStatus @default(ACTIVE)
|
|
3054
|
+
total_price Decimal? @db.Decimal(18, 2)
|
|
3055
|
+
currency String? @default("INR")
|
|
3056
|
+
description String?
|
|
3057
|
+
|
|
3058
|
+
interview_ai_assisted_hours_purchased Decimal? @db.Decimal(20, 4)
|
|
3059
|
+
interview_full_ai_hours_purchased Decimal? @db.Decimal(20, 4)
|
|
3060
|
+
interview_non_ai_hours_purchased Decimal? @db.Decimal(20, 4)
|
|
3061
|
+
assignment_count_purchased Decimal? @db.Decimal(20, 4)
|
|
3062
|
+
test_count_purchased Decimal? @db.Decimal(20, 4)
|
|
3063
|
+
resume_count_purchased Decimal? @db.Decimal(20, 4)
|
|
3064
|
+
credits_purchased Decimal? @db.Decimal(20, 4)
|
|
3065
|
+
|
|
3066
|
+
interview_ai_assisted_hours_remaining Decimal? @db.Decimal(20, 4)
|
|
3067
|
+
interview_full_ai_hours_remaining Decimal? @db.Decimal(20, 4)
|
|
3068
|
+
interview_non_ai_hours_remaining Decimal? @db.Decimal(20, 4)
|
|
3069
|
+
assignment_count_remaining Decimal? @db.Decimal(20, 4)
|
|
3070
|
+
test_count_remaining Decimal? @db.Decimal(20, 4)
|
|
3071
|
+
resume_count_remaining Decimal? @db.Decimal(20, 4)
|
|
3072
|
+
credits_remaining Decimal? @db.Decimal(20, 4)
|
|
3073
|
+
|
|
3074
|
+
created_at DateTime @default(now())
|
|
3075
|
+
updated_at DateTime @updatedAt
|
|
3076
|
+
created_by String
|
|
3077
|
+
updated_by String
|
|
3078
|
+
is_active Boolean @default(true)
|
|
3079
|
+
|
|
3080
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3081
|
+
|
|
3082
|
+
@@index([organisation_id])
|
|
3083
|
+
@@index([organisation_id, status])
|
|
3084
|
+
@@map("purchased_top_ups")
|
|
3085
|
+
@@schema("licensing")
|
|
3086
|
+
}
|
|
3087
|
+
|
|
2733
3088
|
model LiveAnalysis {
|
|
2734
3089
|
id String @id @default(uuid())
|
|
2735
3090
|
//foreign keys
|
|
@@ -3152,65 +3507,71 @@ enum OrganisationSize {
|
|
|
3152
3507
|
}
|
|
3153
3508
|
|
|
3154
3509
|
model Organisation {
|
|
3155
|
-
id
|
|
3156
|
-
name
|
|
3157
|
-
industry
|
|
3158
|
-
about
|
|
3159
|
-
website
|
|
3160
|
-
size
|
|
3161
|
-
phone
|
|
3162
|
-
address
|
|
3163
|
-
company_values
|
|
3164
|
-
allowed_email_domains
|
|
3165
|
-
send_email
|
|
3166
|
-
interviewers
|
|
3167
|
-
created_at
|
|
3168
|
-
updated_at
|
|
3169
|
-
created_by
|
|
3170
|
-
updated_by
|
|
3171
|
-
is_active
|
|
3172
|
-
alias
|
|
3173
|
-
logo
|
|
3174
|
-
job_sequence
|
|
3175
|
-
employee_sequence
|
|
3176
|
-
applications
|
|
3177
|
-
user_roles
|
|
3178
|
-
job_descriptions
|
|
3179
|
-
job_profiles
|
|
3180
|
-
assessment_library
|
|
3181
|
-
assignment_library
|
|
3182
|
-
interviews
|
|
3183
|
-
assignments
|
|
3184
|
-
fit_check
|
|
3185
|
-
resumes
|
|
3186
|
-
approvals
|
|
3187
|
-
suggestions
|
|
3188
|
-
ongoing_evaluations
|
|
3189
|
-
actions
|
|
3190
|
-
integration_credentials
|
|
3191
|
-
zoho_sync_mappings
|
|
3192
|
-
assessments
|
|
3193
|
-
timezone
|
|
3510
|
+
id String @id @default(uuid())
|
|
3511
|
+
name String @unique
|
|
3512
|
+
industry String
|
|
3513
|
+
about String
|
|
3514
|
+
website String
|
|
3515
|
+
size OrganisationSize @default(ONE_TO_TEN)
|
|
3516
|
+
phone String
|
|
3517
|
+
address String
|
|
3518
|
+
company_values Json[]
|
|
3519
|
+
allowed_email_domains String[]
|
|
3520
|
+
send_email Boolean @default(true)
|
|
3521
|
+
interviewers User[]
|
|
3522
|
+
created_at DateTime @default(now())
|
|
3523
|
+
updated_at DateTime @updatedAt
|
|
3524
|
+
created_by String
|
|
3525
|
+
updated_by String
|
|
3526
|
+
is_active Boolean @default(true)
|
|
3527
|
+
alias String? @unique
|
|
3528
|
+
logo String?
|
|
3529
|
+
job_sequence Int @default(1)
|
|
3530
|
+
employee_sequence Int @default(1)
|
|
3531
|
+
applications Application[]
|
|
3532
|
+
user_roles UserRole[]
|
|
3533
|
+
job_descriptions JobDescription[]
|
|
3534
|
+
job_profiles JobProfile[]
|
|
3535
|
+
assessment_library AssessmentLibrary[]
|
|
3536
|
+
assignment_library AssignmentLibrary[]
|
|
3537
|
+
interviews Interview[]
|
|
3538
|
+
assignments Assignment[]
|
|
3539
|
+
fit_check FitCheck[] // one-to-many link
|
|
3540
|
+
resumes Resume[] // one-to-many link
|
|
3541
|
+
approvals Approval[] // one-to-many link
|
|
3542
|
+
suggestions Suggestion[]
|
|
3543
|
+
ongoing_evaluations OngoingEvaluation[] // optional one-to-many
|
|
3544
|
+
actions Action[]
|
|
3545
|
+
integration_credentials IntegrationCredential[]
|
|
3546
|
+
zoho_sync_mappings ZohoSyncMapping[]
|
|
3547
|
+
assessments Assessment[]
|
|
3548
|
+
timezone String @default("Asia/Kolkata")
|
|
3194
3549
|
/// ISO 3166-1 alpha-2 (e.g. IN).
|
|
3195
|
-
country_code
|
|
3196
|
-
organisation_configs
|
|
3197
|
-
activity_events
|
|
3198
|
-
usage_ledger_entries
|
|
3199
|
-
usage_aggregates
|
|
3200
|
-
channel_provider_configs
|
|
3201
|
-
conversations
|
|
3202
|
-
communication_messages
|
|
3203
|
-
job_application_fields
|
|
3204
|
-
documents
|
|
3205
|
-
job_application_templates
|
|
3206
|
-
offer_letter_templates
|
|
3207
|
-
offers
|
|
3208
|
-
sources
|
|
3209
|
-
evaluation_criteria
|
|
3210
|
-
departments
|
|
3211
|
-
hiring_plans
|
|
3212
|
-
employees
|
|
3213
|
-
competency_dictionaries
|
|
3550
|
+
country_code String @default("IN")
|
|
3551
|
+
organisation_configs OrganisationConfig[]
|
|
3552
|
+
activity_events ActivityEvent[]
|
|
3553
|
+
usage_ledger_entries UsageLedgerEntry[]
|
|
3554
|
+
usage_aggregates UsageAggregate[]
|
|
3555
|
+
channel_provider_configs ChannelProviderConfig[]
|
|
3556
|
+
conversations Conversation[]
|
|
3557
|
+
communication_messages CommunicationMessage[]
|
|
3558
|
+
job_application_fields JobApplicationField[]
|
|
3559
|
+
documents Document[]
|
|
3560
|
+
job_application_templates JobApplicationTemplate[]
|
|
3561
|
+
offer_letter_templates OfferLetterTemplate[]
|
|
3562
|
+
offers Offer[]
|
|
3563
|
+
sources Source[]
|
|
3564
|
+
evaluation_criteria EvaluationCriteria[]
|
|
3565
|
+
departments Department[]
|
|
3566
|
+
hiring_plans HiringPlan[]
|
|
3567
|
+
employees Employee[]
|
|
3568
|
+
competency_dictionaries CompetencyDictionary[]
|
|
3569
|
+
purchased_license_packages PurchasedLicensePackage[]
|
|
3570
|
+
purchased_hiring_units PurchasedHiringUnit[]
|
|
3571
|
+
purchased_top_ups PurchasedTopUp[]
|
|
3572
|
+
licensing_ledger_entries LicensingLedgerEntry[]
|
|
3573
|
+
license_package_organisations LicensePackageOrganisation[]
|
|
3574
|
+
ai_cost_ledger_entries AiCostLedgerEntry[]
|
|
3214
3575
|
|
|
3215
3576
|
@@index([name])
|
|
3216
3577
|
@@schema("public")
|
|
@@ -3675,7 +4036,7 @@ datasource db {
|
|
|
3675
4036
|
provider = "postgresql"
|
|
3676
4037
|
url = env("DATABASE_URL")
|
|
3677
4038
|
|
|
3678
|
-
schemas = ["public", "analytics", "usage"]
|
|
4039
|
+
schemas = ["public", "analytics", "usage", "licensing"]
|
|
3679
4040
|
}
|
|
3680
4041
|
|
|
3681
4042
|
enum SourceCategory {
|