@adaptware/eagles-db 0.5.36 → 0.5.37
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 -11
- package/client/index-browser.js +225 -4
- package/client/index.d.ts +107098 -86713
- package/client/index.js +231 -11
- package/client/libquery_engine-darwin.dylib.node +0 -0
- package/client/package.json +1 -1
- package/client/schema.prisma +467 -118
- package/client/wasm.js +231 -11
- package/package.json +1 -1
- package/prisma/.DS_Store +0 -0
- package/prisma/migrations/20260519120000_migrate_shortlisted_to_selected/migration.sql +2 -0
- package/prisma/schema/.DS_Store +0 -0
- package/prisma/schema/applications.prisma +29 -34
- package/prisma/schema/department.prisma +3 -2
- package/prisma/schema/document.prisma +0 -1
- package/prisma/schema/jobDescription.prisma +1 -0
- package/prisma/schema/licensing/aiCostLedger.prisma +34 -0
- package/prisma/schema/licensing/assignmentHistory.prisma +19 -0
- package/prisma/schema/licensing/licensePackageCatalog.prisma +62 -0
- package/prisma/schema/licensing/licensingEnums.prisma +80 -0
- package/prisma/schema/licensing/licensingLedger.prisma +32 -0
- package/prisma/schema/licensing/purchasedLicense.prisma +74 -0
- package/prisma/schema/licensing/purchasedTopUp.prisma +39 -0
- package/prisma/schema/migrations/20260519120000_add_analytics_schema/migration.sql +84 -0
- package/prisma/schema/migrations/20260625120000_add_interviewer_analytics/migration.sql +26 -0
- package/prisma/schema/migrations/20260629120000_add_user_lifecycle_activity_events/migration.sql +13 -0
- package/prisma/schema/migrations/20260629140000_drop_organisation_org_code/migration.sql +2 -0
- package/prisma/schema/migrations/20260629160000_employee_codes_dual_interviewer_analytics/migration.sql +87 -0
- package/prisma/schema/migrations/20260630120000_add_application_sources/migration.sql +38 -0
- package/prisma/schema/migrations/20260701120000_add_source_effectiveness_analytics/migration.sql +40 -0
- package/prisma/schema/migrations/20260702120000_add_analytics_daily_tables/migration.sql +232 -0
- package/prisma/schema/migrations/20260716120000_evaluation_category_four_values/migration.sql +204 -0
- package/prisma/schema/migrations/20260716130000_application_withdrawn_analytics/migration.sql +31 -0
- package/prisma/schema/migrations/20260804120000_contact_us_optional_website_subject/migration.sql +3 -0
- package/prisma/schema/migrations/20260810120000_add_licensing_schema/migration.sql +237 -0
- package/prisma/schema/migrations/20260814153000_add_licensing_ledger/migration.sql +236 -0
- package/prisma/schema/migrations/20260828120000_license_package_orgs_cost_price_ai_cost_ledger/migration.sql +74 -0
- package/prisma/schema/migrations/20260831120000_ai_cost_ledger_purchase_reason/migration.sql +2 -0
- package/prisma/schema/migrations/20260831140000_ai_cost_ledger_nullable_hiring_unit/migration.sql +3 -0
- package/prisma/schema/organisation.prisma +6 -0
- package/prisma/schema/schema.prisma +1 -1
- package/prisma/schema/migrations/.DS_Store +0 -0
- package/prisma/schema/migrations/20260826160000_add_application_fit_check_report_document/.DS_Store +0 -0
- package/prisma/schema/migrations/20260826160000_add_application_fit_check_report_document/migration.sql +0 -13
|
Binary file
|
package/client/package.json
CHANGED
package/client/schema.prisma
CHANGED
|
@@ -414,53 +414,49 @@ enum ApplicationOfferSubstatus {
|
|
|
414
414
|
|
|
415
415
|
model Application {
|
|
416
416
|
/// Primary key
|
|
417
|
-
id
|
|
417
|
+
id String @id @default(uuid())
|
|
418
418
|
/// Foreign keys
|
|
419
|
-
organisation_id
|
|
420
|
-
candidate_id
|
|
421
|
-
resume_id
|
|
422
|
-
job_description_id
|
|
423
|
-
evaluation_plan_id
|
|
424
|
-
recruiter_id
|
|
425
|
-
source_id
|
|
419
|
+
organisation_id String
|
|
420
|
+
candidate_id String
|
|
421
|
+
resume_id String
|
|
422
|
+
job_description_id String
|
|
423
|
+
evaluation_plan_id String?
|
|
424
|
+
recruiter_id String?
|
|
425
|
+
source_id String?
|
|
426
426
|
/// Data fields
|
|
427
|
-
fit_check_score
|
|
428
|
-
applied_at
|
|
429
|
-
round_no
|
|
430
|
-
is_jaf_completed
|
|
431
|
-
proceed_to_next_round
|
|
432
|
-
evaluationComment
|
|
427
|
+
fit_check_score Float?
|
|
428
|
+
applied_at DateTime @default(now())
|
|
429
|
+
round_no Int @default(0)
|
|
430
|
+
is_jaf_completed Boolean @default(false)
|
|
431
|
+
proceed_to_next_round Boolean? @default(false)
|
|
432
|
+
evaluationComment String?
|
|
433
433
|
/// Candidate flag (orthogonal to ApplicationStatus). Latest actor/comment only.
|
|
434
|
-
is_flagged
|
|
435
|
-
flag_comment
|
|
436
|
-
flagged_at
|
|
437
|
-
flagged_by
|
|
438
|
-
unflag_comment
|
|
439
|
-
unflagged_at
|
|
440
|
-
unflagged_by
|
|
441
|
-
fit_check_status
|
|
442
|
-
status
|
|
434
|
+
is_flagged Boolean @default(false)
|
|
435
|
+
flag_comment String?
|
|
436
|
+
flagged_at DateTime?
|
|
437
|
+
flagged_by String?
|
|
438
|
+
unflag_comment String?
|
|
439
|
+
unflagged_at DateTime?
|
|
440
|
+
unflagged_by String?
|
|
441
|
+
fit_check_status FitCheckStatus?
|
|
442
|
+
status ApplicationStatus @default(PENDING)
|
|
443
443
|
/// Fine-grained offer-stage state. Meaningful only when status = OFFER (or was OFFER for a terminal-substatus that flipped to REJECTED / JOINED).
|
|
444
|
-
offer_substatus
|
|
444
|
+
offer_substatus ApplicationOfferSubstatus?
|
|
445
445
|
/// Audit fields
|
|
446
|
-
created_at
|
|
447
|
-
updated_at
|
|
448
|
-
created_by
|
|
449
|
-
updated_by
|
|
450
|
-
is_active
|
|
451
|
-
fit_check_report_document_id String? @unique
|
|
452
|
-
fit_check_report_updated_flag Boolean @default(false)
|
|
453
|
-
fit_check_report_data Json? @default("{}")
|
|
454
|
-
|
|
446
|
+
created_at DateTime @default(now())
|
|
447
|
+
updated_at DateTime @updatedAt
|
|
448
|
+
created_by String
|
|
449
|
+
updated_by String
|
|
450
|
+
is_active Boolean @default(true)
|
|
455
451
|
/// Relations
|
|
456
|
-
evaluation_plan EvaluationPlan?
|
|
457
|
-
candidate User
|
|
458
|
-
organisation Organisation
|
|
459
|
-
resume Resume
|
|
460
|
-
job_description JobDescription
|
|
452
|
+
evaluation_plan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id])
|
|
453
|
+
candidate User @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
454
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
455
|
+
resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
456
|
+
job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
461
457
|
fit_check FitCheck?
|
|
462
|
-
recruiter User?
|
|
463
|
-
source Source?
|
|
458
|
+
recruiter User? @relation("ApplicationRecruiter", fields: [recruiter_id], references: [id])
|
|
459
|
+
source Source? @relation(fields: [source_id], references: [id], onDelete: SetNull)
|
|
464
460
|
interviews Interview[]
|
|
465
461
|
assignments Assignment[]
|
|
466
462
|
ongoing_evaluations OngoingEvaluation[]
|
|
@@ -470,7 +466,6 @@ model Application {
|
|
|
470
466
|
communication_messages CommunicationMessage[]
|
|
471
467
|
job_application_responses JobApplicationResponse[]
|
|
472
468
|
offer Offer?
|
|
473
|
-
fit_check_report_document Document? @relation("ApplicationFitCheckReportDocument", fields: [fit_check_report_document_id], references: [id], onDelete: SetNull)
|
|
474
469
|
|
|
475
470
|
@@unique([candidate_id, job_description_id]) // Ensures candidate applies only once per job
|
|
476
471
|
@@index([candidate_id])
|
|
@@ -1284,24 +1279,25 @@ enum HiringPlanSectionStatus {
|
|
|
1284
1279
|
/// Replaces the free-text `business_unit` string on HiringPlanLine / Employee.
|
|
1285
1280
|
/// Headship lives on DepartmentMember.is_head (at most one per dept, enforced in service).
|
|
1286
1281
|
model Department {
|
|
1287
|
-
id
|
|
1288
|
-
organisation_id
|
|
1289
|
-
name
|
|
1290
|
-
code
|
|
1282
|
+
id String @id @default(uuid())
|
|
1283
|
+
organisation_id String
|
|
1284
|
+
name String
|
|
1285
|
+
code String?
|
|
1291
1286
|
/// 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
|
|
1287
|
+
sort_order Int @default(0)
|
|
1288
|
+
created_at DateTime @default(now())
|
|
1289
|
+
updated_at DateTime @updatedAt
|
|
1290
|
+
created_by String
|
|
1291
|
+
updated_by String
|
|
1292
|
+
is_active Boolean @default(true)
|
|
1293
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1294
|
+
members DepartmentMember[]
|
|
1295
|
+
hiring_plan_lines HiringPlanLine[]
|
|
1296
|
+
employees Employee[]
|
|
1297
|
+
job_descriptions JobDescription[]
|
|
1298
|
+
job_profiles JobProfile[]
|
|
1299
|
+
sections HiringPlanSection[]
|
|
1300
|
+
assigned_hiring_units PurchasedHiringUnit[]
|
|
1305
1301
|
|
|
1306
1302
|
@@unique([organisation_id, name])
|
|
1307
1303
|
@@index([organisation_id])
|
|
@@ -1405,7 +1401,6 @@ model Document {
|
|
|
1405
1401
|
offer_letters OfferLetter[] @relation("OfferLetterPdf")
|
|
1406
1402
|
offer_letter_template_snapshots OfferLetter[] @relation("OfferLetterTemplateSnapshot")
|
|
1407
1403
|
offer_draft_edited_html Offer[] @relation("OfferDraftEditedHtml")
|
|
1408
|
-
application_fit_check_report Application? @relation("ApplicationFitCheckReportDocument")
|
|
1409
1404
|
|
|
1410
1405
|
// Indexes
|
|
1411
1406
|
@@index([candidate_id])
|
|
@@ -2539,6 +2534,7 @@ model JobDescription {
|
|
|
2539
2534
|
hiring_plan_line HiringPlanLine? @relation("PlanLineRequisitions", fields: [hiring_plan_line_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
2540
2535
|
/// Plan lines that use this JD as the role template/reference.
|
|
2541
2536
|
referenced_by_plan_lines HiringPlanLine[] @relation("PlanLineTemplateJd")
|
|
2537
|
+
linked_hiring_units PurchasedHiringUnit[]
|
|
2542
2538
|
|
|
2543
2539
|
@@index([organisation_id])
|
|
2544
2540
|
@@index([hiring_manager_id])
|
|
@@ -2730,6 +2726,353 @@ model JobRoundAnalyticsDaily {
|
|
|
2730
2726
|
@@schema("analytics")
|
|
2731
2727
|
}
|
|
2732
2728
|
|
|
2729
|
+
/// Append-only book of AI workflow cost (org pool, optionally a hiring unit).
|
|
2730
|
+
/// Covers every workflow (including license-included names). Amount is always USD.
|
|
2731
|
+
/// total_cost(unit) = SUM(DEBIT amount) - SUM(CREDIT amount) for that unit.
|
|
2732
|
+
/// CREDIT / PURCHASE is full package internal cost (USD) per hiring unit.
|
|
2733
|
+
/// DEBIT / USAGE is every workflow's Orion totalCost (USD), nothing excluded.
|
|
2734
|
+
model AiCostLedgerEntry {
|
|
2735
|
+
id String @id @default(uuid())
|
|
2736
|
+
organisation_id String
|
|
2737
|
+
purchased_hiring_unit_id String?
|
|
2738
|
+
workflow_name String
|
|
2739
|
+
direction LicensingLedgerDirection
|
|
2740
|
+
/// Always non-negative. USD.
|
|
2741
|
+
amount Decimal @db.Decimal(20, 4)
|
|
2742
|
+
reason AiCostLedgerReason
|
|
2743
|
+
occurred_at DateTime @default(now())
|
|
2744
|
+
source_type String?
|
|
2745
|
+
source_id String?
|
|
2746
|
+
description String?
|
|
2747
|
+
idempotency_key String @unique
|
|
2748
|
+
created_at DateTime @default(now())
|
|
2749
|
+
updated_at DateTime @default(now()) @updatedAt
|
|
2750
|
+
created_by String
|
|
2751
|
+
updated_by String
|
|
2752
|
+
is_active Boolean @default(true)
|
|
2753
|
+
|
|
2754
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2755
|
+
purchased_hiring_unit PurchasedHiringUnit? @relation(fields: [purchased_hiring_unit_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2756
|
+
|
|
2757
|
+
@@index([purchased_hiring_unit_id, occurred_at], map: "ai_cost_ledger_unit_occurred_idx")
|
|
2758
|
+
@@index([purchased_hiring_unit_id, workflow_name, occurred_at], map: "ai_cost_ledger_unit_workflow_occurred_idx")
|
|
2759
|
+
@@index([organisation_id, occurred_at], map: "ai_cost_ledger_org_occurred_idx")
|
|
2760
|
+
@@map("ai_cost_ledger")
|
|
2761
|
+
@@schema("licensing")
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2764
|
+
/// Immutable assignment history for Hiring Unit department/job changes.
|
|
2765
|
+
model PurchasedHiringUnitAssignmentEvent {
|
|
2766
|
+
id String @id @default(uuid())
|
|
2767
|
+
purchased_hiring_unit_id String
|
|
2768
|
+
event_kind PurchasedHiringUnitAssignmentEventKind
|
|
2769
|
+
previous_department_id String?
|
|
2770
|
+
new_department_id String?
|
|
2771
|
+
previous_job_description_id String?
|
|
2772
|
+
new_job_description_id String?
|
|
2773
|
+
effective_at DateTime @default(now())
|
|
2774
|
+
created_by String
|
|
2775
|
+
|
|
2776
|
+
purchased_hiring_unit PurchasedHiringUnit @relation(fields: [purchased_hiring_unit_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2777
|
+
|
|
2778
|
+
@@index([purchased_hiring_unit_id], map: "purchased_hu_assignment_events_unit_id_idx")
|
|
2779
|
+
@@index([purchased_hiring_unit_id, effective_at], map: "purchased_hu_assignment_events_unit_effective_idx")
|
|
2780
|
+
@@map("purchased_hiring_unit_assignment_events")
|
|
2781
|
+
@@schema("licensing")
|
|
2782
|
+
}
|
|
2783
|
+
|
|
2784
|
+
/// Product catalogue: one wide row per (code, version) with fixed per-hiring-unit entitlements.
|
|
2785
|
+
/// See eagles-db/docs/eagles-db/licensing-catalog.md for column → usage metric_key mapping at purchase.
|
|
2786
|
+
model LicensePackage {
|
|
2787
|
+
id String @id @default(uuid())
|
|
2788
|
+
code String
|
|
2789
|
+
version Int
|
|
2790
|
+
name String
|
|
2791
|
+
description String?
|
|
2792
|
+
price Decimal @db.Decimal(18, 2)
|
|
2793
|
+
/// Internal cost of the package. Same currency as `currency`. Not for org-facing catalogue APIs.
|
|
2794
|
+
cost_price Decimal @default(0) @db.Decimal(18, 2)
|
|
2795
|
+
currency String @default("INR")
|
|
2796
|
+
status LicensePackageStatus @default(DRAFT)
|
|
2797
|
+
/// Number of PurchasedHiringUnit rows created per package purchase.
|
|
2798
|
+
units_per_purchase Int
|
|
2799
|
+
|
|
2800
|
+
/// Per-hiring-unit entitlements. null = not included; 0 = explicitly zero.
|
|
2801
|
+
interview_ai_assisted_hours Decimal? @db.Decimal(20, 4)
|
|
2802
|
+
interview_full_ai_hours Decimal? @db.Decimal(20, 4)
|
|
2803
|
+
interview_non_ai_hours Decimal? @db.Decimal(20, 4)
|
|
2804
|
+
assignment_count Decimal? @db.Decimal(20, 4)
|
|
2805
|
+
test_count Decimal? @db.Decimal(20, 4)
|
|
2806
|
+
resume_count Decimal? @db.Decimal(20, 4)
|
|
2807
|
+
credits Decimal? @db.Decimal(20, 4)
|
|
2808
|
+
|
|
2809
|
+
created_at DateTime @default(now())
|
|
2810
|
+
updated_at DateTime @updatedAt
|
|
2811
|
+
created_by String
|
|
2812
|
+
updated_by String
|
|
2813
|
+
is_active Boolean @default(true)
|
|
2814
|
+
|
|
2815
|
+
purchased_license_packages PurchasedLicensePackage[]
|
|
2816
|
+
organisations LicensePackageOrganisation[]
|
|
2817
|
+
|
|
2818
|
+
@@unique([code, version])
|
|
2819
|
+
@@index([code])
|
|
2820
|
+
@@index([status])
|
|
2821
|
+
@@map("license_packages")
|
|
2822
|
+
@@schema("licensing")
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
/// Many-to-many: which organisations may see this catalogue package.
|
|
2826
|
+
/// Zero rows = visible to nobody except platform list (enforced later in eagles-backend).
|
|
2827
|
+
model LicensePackageOrganisation {
|
|
2828
|
+
id String @id @default(uuid())
|
|
2829
|
+
license_package_id String
|
|
2830
|
+
organisation_id String
|
|
2831
|
+
|
|
2832
|
+
created_at DateTime @default(now())
|
|
2833
|
+
updated_at DateTime @updatedAt
|
|
2834
|
+
created_by String
|
|
2835
|
+
updated_by String
|
|
2836
|
+
is_active Boolean @default(true)
|
|
2837
|
+
|
|
2838
|
+
license_package LicensePackage @relation(fields: [license_package_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2839
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2840
|
+
|
|
2841
|
+
@@unique([license_package_id, organisation_id], map: "license_package_orgs_pkg_org_key")
|
|
2842
|
+
@@index([organisation_id])
|
|
2843
|
+
@@map("license_package_organisations")
|
|
2844
|
+
@@schema("licensing")
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
enum LicensePackageStatus {
|
|
2848
|
+
DRAFT
|
|
2849
|
+
ACTIVE
|
|
2850
|
+
ARCHIVED
|
|
2851
|
+
|
|
2852
|
+
@@schema("licensing")
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
enum PurchasedLicensePackageStatus {
|
|
2856
|
+
ACTIVE
|
|
2857
|
+
EXPIRED
|
|
2858
|
+
CANCELLED
|
|
2859
|
+
|
|
2860
|
+
@@schema("licensing")
|
|
2861
|
+
}
|
|
2862
|
+
|
|
2863
|
+
enum PurchasedHiringUnitStatus {
|
|
2864
|
+
AVAILABLE
|
|
2865
|
+
ASSIGNED
|
|
2866
|
+
ACTIVE
|
|
2867
|
+
EXPIRED
|
|
2868
|
+
|
|
2869
|
+
@@schema("licensing")
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
enum PurchasedTopUpStatus {
|
|
2873
|
+
ACTIVE
|
|
2874
|
+
DEPLETED
|
|
2875
|
+
CANCELLED
|
|
2876
|
+
|
|
2877
|
+
@@schema("licensing")
|
|
2878
|
+
}
|
|
2879
|
+
|
|
2880
|
+
enum PurchasedHiringUnitAssignmentEventKind {
|
|
2881
|
+
DEPARTMENT_ASSIGNED
|
|
2882
|
+
DEPARTMENT_UNASSIGNED
|
|
2883
|
+
JOB_LINKED
|
|
2884
|
+
JOB_UNLINKED
|
|
2885
|
+
|
|
2886
|
+
@@schema("licensing")
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
enum LicensingLedgerEntitlementType {
|
|
2890
|
+
INTERVIEW_AI_ASSISTED_HOURS
|
|
2891
|
+
INTERVIEW_FULL_AI_HOURS
|
|
2892
|
+
INTERVIEW_NON_AI_HOURS
|
|
2893
|
+
ASSIGNMENT_COUNT
|
|
2894
|
+
TEST_COUNT
|
|
2895
|
+
RESUME_COUNT
|
|
2896
|
+
CREDITS
|
|
2897
|
+
|
|
2898
|
+
@@schema("licensing")
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
enum LicensingLedgerDirection {
|
|
2902
|
+
CREDIT
|
|
2903
|
+
DEBIT
|
|
2904
|
+
|
|
2905
|
+
@@schema("licensing")
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2908
|
+
enum LicensingLedgerReason {
|
|
2909
|
+
PURCHASE
|
|
2910
|
+
TOP_UP
|
|
2911
|
+
USAGE
|
|
2912
|
+
ADJUSTMENT
|
|
2913
|
+
REFUND
|
|
2914
|
+
EXPIRY
|
|
2915
|
+
|
|
2916
|
+
@@schema("licensing")
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
enum AiCostLedgerReason {
|
|
2920
|
+
PURCHASE
|
|
2921
|
+
USAGE
|
|
2922
|
+
ADJUSTMENT
|
|
2923
|
+
REFUND
|
|
2924
|
+
|
|
2925
|
+
@@schema("licensing")
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
/// Append-only book of hiring-unit entitlement movements.
|
|
2929
|
+
/// remaining(unit, type) = SUM(CREDIT amount) - SUM(DEBIT amount).
|
|
2930
|
+
/// See eagles-db/docs/eagles-db/licensing-hiring-unit.md.
|
|
2931
|
+
model LicensingLedgerEntry {
|
|
2932
|
+
id String @id @default(uuid())
|
|
2933
|
+
organisation_id String
|
|
2934
|
+
/// Null for org-level rows (e.g. unallocated top-ups later).
|
|
2935
|
+
purchased_hiring_unit_id String?
|
|
2936
|
+
entitlement_type LicensingLedgerEntitlementType
|
|
2937
|
+
direction LicensingLedgerDirection
|
|
2938
|
+
/// Always non-negative. CREDIT of 0 means the stem is included at zero.
|
|
2939
|
+
amount Decimal @db.Decimal(20, 4)
|
|
2940
|
+
reason LicensingLedgerReason
|
|
2941
|
+
occurred_at DateTime @default(now())
|
|
2942
|
+
source_type String?
|
|
2943
|
+
source_id String?
|
|
2944
|
+
description String?
|
|
2945
|
+
idempotency_key String @unique
|
|
2946
|
+
created_at DateTime @default(now())
|
|
2947
|
+
updated_at DateTime @default(now()) @updatedAt
|
|
2948
|
+
created_by String
|
|
2949
|
+
updated_by String
|
|
2950
|
+
is_active Boolean @default(true)
|
|
2951
|
+
|
|
2952
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2953
|
+
purchased_hiring_unit PurchasedHiringUnit? @relation(fields: [purchased_hiring_unit_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2954
|
+
|
|
2955
|
+
@@index([purchased_hiring_unit_id, entitlement_type, occurred_at], map: "licensing_ledger_unit_type_occurred_idx")
|
|
2956
|
+
@@index([organisation_id, entitlement_type, occurred_at], map: "licensing_ledger_org_type_occurred_idx")
|
|
2957
|
+
@@map("licensing_ledger")
|
|
2958
|
+
@@schema("licensing")
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
/// Historical package purchase by an organisation (independent per transaction).
|
|
2962
|
+
model PurchasedLicensePackage {
|
|
2963
|
+
id String @id @default(uuid())
|
|
2964
|
+
organisation_id String
|
|
2965
|
+
license_package_id String
|
|
2966
|
+
/// Snapshot of catalogue identity at purchase time.
|
|
2967
|
+
package_code String
|
|
2968
|
+
package_version Int
|
|
2969
|
+
package_name String
|
|
2970
|
+
price Decimal @db.Decimal(18, 2)
|
|
2971
|
+
currency String @default("INR")
|
|
2972
|
+
units_per_purchase Int
|
|
2973
|
+
/// How many package instances were bought in this transaction.
|
|
2974
|
+
package_quantity Int @default(1)
|
|
2975
|
+
purchased_at DateTime @default(now())
|
|
2976
|
+
status PurchasedLicensePackageStatus @default(ACTIVE)
|
|
2977
|
+
created_at DateTime @default(now())
|
|
2978
|
+
updated_at DateTime @updatedAt
|
|
2979
|
+
created_by String
|
|
2980
|
+
updated_by String
|
|
2981
|
+
is_active Boolean @default(true)
|
|
2982
|
+
|
|
2983
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2984
|
+
license_package LicensePackage @relation(fields: [license_package_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2985
|
+
hiring_units PurchasedHiringUnit[]
|
|
2986
|
+
|
|
2987
|
+
@@index([organisation_id])
|
|
2988
|
+
@@index([organisation_id, status])
|
|
2989
|
+
@@index([organisation_id, purchased_at])
|
|
2990
|
+
@@map("purchased_license_packages")
|
|
2991
|
+
@@schema("licensing")
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
/// Runtime hiring unit identity and allocation. Entitlement balances live on
|
|
2995
|
+
/// `licensing.licensing_ledger` (Prisma model `LicensingLedgerEntry`).
|
|
2996
|
+
/// See eagles-db/docs/eagles-db/licensing-hiring-unit.md.
|
|
2997
|
+
model PurchasedHiringUnit {
|
|
2998
|
+
id String @id @default(uuid())
|
|
2999
|
+
organisation_id String
|
|
3000
|
+
purchased_license_package_id String
|
|
3001
|
+
status PurchasedHiringUnitStatus @default(AVAILABLE)
|
|
3002
|
+
/// Current department allocation (licensing allocation, not hiring manager).
|
|
3003
|
+
department_id String?
|
|
3004
|
+
/// Set once when department_id is first assigned; not cleared on reassignment.
|
|
3005
|
+
first_assigned_at DateTime?
|
|
3006
|
+
/// Optional unit expiry.
|
|
3007
|
+
expiry_at DateTime?
|
|
3008
|
+
/// Optional job association (distinct from JobDescription.hiring_manager_id).
|
|
3009
|
+
job_description_id String?
|
|
3010
|
+
|
|
3011
|
+
created_at DateTime @default(now())
|
|
3012
|
+
updated_at DateTime @updatedAt
|
|
3013
|
+
created_by String
|
|
3014
|
+
updated_by String
|
|
3015
|
+
is_active Boolean @default(true)
|
|
3016
|
+
|
|
3017
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3018
|
+
purchased_license_package PurchasedLicensePackage @relation(fields: [purchased_license_package_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3019
|
+
department Department? @relation(fields: [department_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
3020
|
+
job_description JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
3021
|
+
assignment_events PurchasedHiringUnitAssignmentEvent[]
|
|
3022
|
+
ledger_entries LicensingLedgerEntry[]
|
|
3023
|
+
ai_cost_ledger_entries AiCostLedgerEntry[]
|
|
3024
|
+
|
|
3025
|
+
@@index([organisation_id])
|
|
3026
|
+
@@index([purchased_license_package_id])
|
|
3027
|
+
@@index([department_id])
|
|
3028
|
+
@@index([job_description_id])
|
|
3029
|
+
@@index([organisation_id, status])
|
|
3030
|
+
@@index([organisation_id, department_id])
|
|
3031
|
+
@@index([organisation_id, job_description_id])
|
|
3032
|
+
@@map("purchased_hiring_units")
|
|
3033
|
+
@@schema("licensing")
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
/// Wide top-up purchase: org-level per-metric pool (purchased / remaining) before allocation to hiring units.
|
|
3037
|
+
model PurchasedTopUp {
|
|
3038
|
+
id String @id @default(uuid())
|
|
3039
|
+
organisation_id String
|
|
3040
|
+
purchased_at DateTime @default(now())
|
|
3041
|
+
status PurchasedTopUpStatus @default(ACTIVE)
|
|
3042
|
+
total_price Decimal? @db.Decimal(18, 2)
|
|
3043
|
+
currency String? @default("INR")
|
|
3044
|
+
description String?
|
|
3045
|
+
|
|
3046
|
+
interview_ai_assisted_hours_purchased Decimal? @db.Decimal(20, 4)
|
|
3047
|
+
interview_full_ai_hours_purchased Decimal? @db.Decimal(20, 4)
|
|
3048
|
+
interview_non_ai_hours_purchased Decimal? @db.Decimal(20, 4)
|
|
3049
|
+
assignment_count_purchased Decimal? @db.Decimal(20, 4)
|
|
3050
|
+
test_count_purchased Decimal? @db.Decimal(20, 4)
|
|
3051
|
+
resume_count_purchased Decimal? @db.Decimal(20, 4)
|
|
3052
|
+
credits_purchased Decimal? @db.Decimal(20, 4)
|
|
3053
|
+
|
|
3054
|
+
interview_ai_assisted_hours_remaining Decimal? @db.Decimal(20, 4)
|
|
3055
|
+
interview_full_ai_hours_remaining Decimal? @db.Decimal(20, 4)
|
|
3056
|
+
interview_non_ai_hours_remaining Decimal? @db.Decimal(20, 4)
|
|
3057
|
+
assignment_count_remaining Decimal? @db.Decimal(20, 4)
|
|
3058
|
+
test_count_remaining Decimal? @db.Decimal(20, 4)
|
|
3059
|
+
resume_count_remaining Decimal? @db.Decimal(20, 4)
|
|
3060
|
+
credits_remaining Decimal? @db.Decimal(20, 4)
|
|
3061
|
+
|
|
3062
|
+
created_at DateTime @default(now())
|
|
3063
|
+
updated_at DateTime @updatedAt
|
|
3064
|
+
created_by String
|
|
3065
|
+
updated_by String
|
|
3066
|
+
is_active Boolean @default(true)
|
|
3067
|
+
|
|
3068
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3069
|
+
|
|
3070
|
+
@@index([organisation_id])
|
|
3071
|
+
@@index([organisation_id, status])
|
|
3072
|
+
@@map("purchased_top_ups")
|
|
3073
|
+
@@schema("licensing")
|
|
3074
|
+
}
|
|
3075
|
+
|
|
2733
3076
|
model LiveAnalysis {
|
|
2734
3077
|
id String @id @default(uuid())
|
|
2735
3078
|
//foreign keys
|
|
@@ -3152,65 +3495,71 @@ enum OrganisationSize {
|
|
|
3152
3495
|
}
|
|
3153
3496
|
|
|
3154
3497
|
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
|
|
3498
|
+
id String @id @default(uuid())
|
|
3499
|
+
name String @unique
|
|
3500
|
+
industry String
|
|
3501
|
+
about String
|
|
3502
|
+
website String
|
|
3503
|
+
size OrganisationSize @default(ONE_TO_TEN)
|
|
3504
|
+
phone String
|
|
3505
|
+
address String
|
|
3506
|
+
company_values Json[]
|
|
3507
|
+
allowed_email_domains String[]
|
|
3508
|
+
send_email Boolean @default(true)
|
|
3509
|
+
interviewers User[]
|
|
3510
|
+
created_at DateTime @default(now())
|
|
3511
|
+
updated_at DateTime @updatedAt
|
|
3512
|
+
created_by String
|
|
3513
|
+
updated_by String
|
|
3514
|
+
is_active Boolean @default(true)
|
|
3515
|
+
alias String? @unique
|
|
3516
|
+
logo String?
|
|
3517
|
+
job_sequence Int @default(1)
|
|
3518
|
+
employee_sequence Int @default(1)
|
|
3519
|
+
applications Application[]
|
|
3520
|
+
user_roles UserRole[]
|
|
3521
|
+
job_descriptions JobDescription[]
|
|
3522
|
+
job_profiles JobProfile[]
|
|
3523
|
+
assessment_library AssessmentLibrary[]
|
|
3524
|
+
assignment_library AssignmentLibrary[]
|
|
3525
|
+
interviews Interview[]
|
|
3526
|
+
assignments Assignment[]
|
|
3527
|
+
fit_check FitCheck[] // one-to-many link
|
|
3528
|
+
resumes Resume[] // one-to-many link
|
|
3529
|
+
approvals Approval[] // one-to-many link
|
|
3530
|
+
suggestions Suggestion[]
|
|
3531
|
+
ongoing_evaluations OngoingEvaluation[] // optional one-to-many
|
|
3532
|
+
actions Action[]
|
|
3533
|
+
integration_credentials IntegrationCredential[]
|
|
3534
|
+
zoho_sync_mappings ZohoSyncMapping[]
|
|
3535
|
+
assessments Assessment[]
|
|
3536
|
+
timezone String @default("Asia/Kolkata")
|
|
3194
3537
|
/// 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
|
|
3538
|
+
country_code String @default("IN")
|
|
3539
|
+
organisation_configs OrganisationConfig[]
|
|
3540
|
+
activity_events ActivityEvent[]
|
|
3541
|
+
usage_ledger_entries UsageLedgerEntry[]
|
|
3542
|
+
usage_aggregates UsageAggregate[]
|
|
3543
|
+
channel_provider_configs ChannelProviderConfig[]
|
|
3544
|
+
conversations Conversation[]
|
|
3545
|
+
communication_messages CommunicationMessage[]
|
|
3546
|
+
job_application_fields JobApplicationField[]
|
|
3547
|
+
documents Document[]
|
|
3548
|
+
job_application_templates JobApplicationTemplate[]
|
|
3549
|
+
offer_letter_templates OfferLetterTemplate[]
|
|
3550
|
+
offers Offer[]
|
|
3551
|
+
sources Source[]
|
|
3552
|
+
evaluation_criteria EvaluationCriteria[]
|
|
3553
|
+
departments Department[]
|
|
3554
|
+
hiring_plans HiringPlan[]
|
|
3555
|
+
employees Employee[]
|
|
3556
|
+
competency_dictionaries CompetencyDictionary[]
|
|
3557
|
+
purchased_license_packages PurchasedLicensePackage[]
|
|
3558
|
+
purchased_hiring_units PurchasedHiringUnit[]
|
|
3559
|
+
purchased_top_ups PurchasedTopUp[]
|
|
3560
|
+
licensing_ledger_entries LicensingLedgerEntry[]
|
|
3561
|
+
license_package_organisations LicensePackageOrganisation[]
|
|
3562
|
+
ai_cost_ledger_entries AiCostLedgerEntry[]
|
|
3214
3563
|
|
|
3215
3564
|
@@index([name])
|
|
3216
3565
|
@@schema("public")
|
|
@@ -3675,7 +4024,7 @@ datasource db {
|
|
|
3675
4024
|
provider = "postgresql"
|
|
3676
4025
|
url = env("DATABASE_URL")
|
|
3677
4026
|
|
|
3678
|
-
schemas = ["public", "analytics", "usage"]
|
|
4027
|
+
schemas = ["public", "analytics", "usage", "licensing"]
|
|
3679
4028
|
}
|
|
3680
4029
|
|
|
3681
4030
|
enum SourceCategory {
|