@adaptware/eagles-db 0.5.33 → 0.5.35
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 +310 -8
- package/client/index-browser.js +304 -1
- package/client/index.d.ts +73435 -47033
- package/client/index.js +310 -8
- package/client/libquery_engine-darwin.dylib.node +0 -0
- package/client/package.json +1 -1
- package/client/schema.prisma +547 -76
- package/client/wasm.js +310 -8
- 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/department.prisma +3 -2
- package/prisma/schema/integration.prisma +1 -0
- 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 +66 -58
- package/prisma/schema/payment/billingTransaction.prisma +83 -0
- package/prisma/schema/payment/paymentWebhookEvent.prisma +28 -0
- package/prisma/schema/schema.prisma +1 -1
- package/prisma/schema/migrations/20260522120000_ongoing_evaluation_record_kind/migration.sql +0 -25
- package/prisma/schema/migrations/20260523120000_replace_record_kind_with_is_committed/migration.sql +0 -24
- package/prisma/schema/migrations/20260528120000_drop_job_description_recommendation_config/migration.sql +0 -2
- package/prisma/schema/migrations/20260710120000_add_resume_rendered_export_fields/migration.sql +0 -9
- package/prisma/schema/migrations/20260714120000_add_job_description_display_html_document/migration.sql +0 -8
- package/prisma/schema/migrations/20260716120000_add_offer_letters/migration.sql +0 -183
- package/prisma/schema/migrations/20260716140000_offer_schema_refinements/migration.sql +0 -13
- package/prisma/schema/migrations/20260716160000_offer_schema_hardening/migration.sql +0 -95
- package/prisma/schema/migrations/20260716180000_offer_letter_template_config/migration.sql +0 -2
- package/prisma/schema/migrations/20260716190000_add_evaluation_focus_areas/migration.sql +0 -6
- package/prisma/schema/migrations/20260717120000_offer_workflow_approval/migration.sql +0 -30
- package/prisma/schema/migrations/20260720120000_offer_letter_template_is_draft/migration.sql +0 -5
- package/prisma/schema/migrations/20260720140000_offer_status_split/migration.sql +0 -51
- package/prisma/schema/migrations/20260720140001_offer_status_split_backfill/migration.sql +0 -37
- package/prisma/schema/migrations/20260722120000_offer_draft_edited_html/migration.sql +0 -13
- package/prisma/schema/migrations/20260723150000_offer_withdraw_actor_no_show_reason/migration.sql +0 -10
- package/prisma/schema/migrations/20260724120000_open_job_offer_accepted_declined_counts/migration.sql +0 -7
- package/prisma/schema/migrations/20260811120000_add_integration_provider_razorpay/migration.sql +0 -6
- package/prisma/schema/migrations/20260812120000_add_billing_transactions/migration.sql +0 -49
- package/prisma/schema/migrations/20260812130000_drop_billing_transaction_gst_snapshots/migration.sql +0 -3
- package/prisma/schema/migrations/20260812180000_billing_transaction_invoice_number/migration.sql +0 -5
- package/prisma/schema/migrations/20260813120000_payment_webhooks_gst_refunds/migration.sql +0 -79
- package/prisma/schema/migrations/20260813140000_platform_gst_profiles/migration.sql +0 -49
- package/prisma/schema/migrations/20260813150000_rename_gst_profiles/migration.sql +0 -53
- package/prisma/schema/migrations/20260813160000_remove_gst_billing/migration.sql +0 -16
- package/prisma/schema/migrations/20260813170000_billing_licensing_unrecoverable/migration.sql +0 -2
- package/prisma/schema/migrations/20260813180000_billing_transaction_payment_method/migration.sql +0 -2
- package/prisma/schema/migrations/20260814090000_billing_transaction_purchaser_email/migration.sql +0 -2
- package/prisma/schema/migrations/20260816100000_billing_product_organisations/migration.sql +0 -35
- package/prisma/schema/migrations/20260816120000_merge_billing_product_organisations/migration.sql +0 -25
- package/prisma/schema/migrations/20260817120000_billing_payment_mismatch/migration.sql +0 -7
- package/prisma/schema/migrations/20260819120000_billing_product_prices/migration.sql +0 -62
- package/prisma/schema/migrations/20260819140000_billing_exchange_rates/migration.sql +0 -25
- package/prisma/schema/migrations/20260820120000_billing_transaction_failure_category/migration.sql +0 -31
- package/prisma/schema/migrations/20260820130000_backfill_billing_transaction_failure_details/migration.sql +0 -23
- package/prisma/schema/migrations/20260820140000_drop_billing_product_price_overrides/migration.sql +0 -2
- package/prisma/schema/migrations/20260821120000_drop_billing_product_and_mock_licensing/migration.sql +0 -38
- package/prisma/schema/migrations/20260824120000_billing_transaction_purchase_display_name/migration.sql +0 -2
- package/prisma/schema/migrations/20260831120000_user_communication_email/migration.sql +0 -6
|
Binary file
|
package/client/package.json
CHANGED
package/client/schema.prisma
CHANGED
|
@@ -1279,24 +1279,25 @@ enum HiringPlanSectionStatus {
|
|
|
1279
1279
|
/// Replaces the free-text `business_unit` string on HiringPlanLine / Employee.
|
|
1280
1280
|
/// Headship lives on DepartmentMember.is_head (at most one per dept, enforced in service).
|
|
1281
1281
|
model Department {
|
|
1282
|
-
id
|
|
1283
|
-
organisation_id
|
|
1284
|
-
name
|
|
1285
|
-
code
|
|
1282
|
+
id String @id @default(uuid())
|
|
1283
|
+
organisation_id String
|
|
1284
|
+
name String
|
|
1285
|
+
code String?
|
|
1286
1286
|
/// Global display order across departments within the org (drag-reorder in plan grid).
|
|
1287
|
-
sort_order
|
|
1288
|
-
created_at
|
|
1289
|
-
updated_at
|
|
1290
|
-
created_by
|
|
1291
|
-
updated_by
|
|
1292
|
-
is_active
|
|
1293
|
-
organisation
|
|
1294
|
-
members
|
|
1295
|
-
hiring_plan_lines
|
|
1296
|
-
employees
|
|
1297
|
-
job_descriptions
|
|
1298
|
-
job_profiles
|
|
1299
|
-
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[]
|
|
1300
1301
|
|
|
1301
1302
|
@@unique([organisation_id, name])
|
|
1302
1303
|
@@index([organisation_id])
|
|
@@ -1836,6 +1837,7 @@ enum IntegrationProvider {
|
|
|
1836
1837
|
MICROSOFT
|
|
1837
1838
|
ZOOM
|
|
1838
1839
|
CALENDLY
|
|
1840
|
+
RAZORPAY
|
|
1839
1841
|
|
|
1840
1842
|
@@schema("public")
|
|
1841
1843
|
}
|
|
@@ -2533,6 +2535,7 @@ model JobDescription {
|
|
|
2533
2535
|
hiring_plan_line HiringPlanLine? @relation("PlanLineRequisitions", fields: [hiring_plan_line_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
2534
2536
|
/// Plan lines that use this JD as the role template/reference.
|
|
2535
2537
|
referenced_by_plan_lines HiringPlanLine[] @relation("PlanLineTemplateJd")
|
|
2538
|
+
linked_hiring_units PurchasedHiringUnit[]
|
|
2536
2539
|
|
|
2537
2540
|
@@index([organisation_id])
|
|
2538
2541
|
@@index([hiring_manager_id])
|
|
@@ -2724,6 +2727,353 @@ model JobRoundAnalyticsDaily {
|
|
|
2724
2727
|
@@schema("analytics")
|
|
2725
2728
|
}
|
|
2726
2729
|
|
|
2730
|
+
/// Append-only book of AI workflow cost (org pool, optionally a hiring unit).
|
|
2731
|
+
/// Covers every workflow (including license-included names). Amount is always USD.
|
|
2732
|
+
/// total_cost(unit) = SUM(DEBIT amount) - SUM(CREDIT amount) for that unit.
|
|
2733
|
+
/// CREDIT / PURCHASE is full package internal cost (USD) per hiring unit.
|
|
2734
|
+
/// DEBIT / USAGE is every workflow's Orion totalCost (USD), nothing excluded.
|
|
2735
|
+
model AiCostLedgerEntry {
|
|
2736
|
+
id String @id @default(uuid())
|
|
2737
|
+
organisation_id String
|
|
2738
|
+
purchased_hiring_unit_id String?
|
|
2739
|
+
workflow_name String
|
|
2740
|
+
direction LicensingLedgerDirection
|
|
2741
|
+
/// Always non-negative. USD.
|
|
2742
|
+
amount Decimal @db.Decimal(20, 4)
|
|
2743
|
+
reason AiCostLedgerReason
|
|
2744
|
+
occurred_at DateTime @default(now())
|
|
2745
|
+
source_type String?
|
|
2746
|
+
source_id String?
|
|
2747
|
+
description String?
|
|
2748
|
+
idempotency_key String @unique
|
|
2749
|
+
created_at DateTime @default(now())
|
|
2750
|
+
updated_at DateTime @default(now()) @updatedAt
|
|
2751
|
+
created_by String
|
|
2752
|
+
updated_by String
|
|
2753
|
+
is_active Boolean @default(true)
|
|
2754
|
+
|
|
2755
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2756
|
+
purchased_hiring_unit PurchasedHiringUnit? @relation(fields: [purchased_hiring_unit_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2757
|
+
|
|
2758
|
+
@@index([purchased_hiring_unit_id, occurred_at], map: "ai_cost_ledger_unit_occurred_idx")
|
|
2759
|
+
@@index([purchased_hiring_unit_id, workflow_name, occurred_at], map: "ai_cost_ledger_unit_workflow_occurred_idx")
|
|
2760
|
+
@@index([organisation_id, occurred_at], map: "ai_cost_ledger_org_occurred_idx")
|
|
2761
|
+
@@map("ai_cost_ledger")
|
|
2762
|
+
@@schema("licensing")
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2765
|
+
/// Immutable assignment history for Hiring Unit department/job changes.
|
|
2766
|
+
model PurchasedHiringUnitAssignmentEvent {
|
|
2767
|
+
id String @id @default(uuid())
|
|
2768
|
+
purchased_hiring_unit_id String
|
|
2769
|
+
event_kind PurchasedHiringUnitAssignmentEventKind
|
|
2770
|
+
previous_department_id String?
|
|
2771
|
+
new_department_id String?
|
|
2772
|
+
previous_job_description_id String?
|
|
2773
|
+
new_job_description_id String?
|
|
2774
|
+
effective_at DateTime @default(now())
|
|
2775
|
+
created_by String
|
|
2776
|
+
|
|
2777
|
+
purchased_hiring_unit PurchasedHiringUnit @relation(fields: [purchased_hiring_unit_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2778
|
+
|
|
2779
|
+
@@index([purchased_hiring_unit_id], map: "purchased_hu_assignment_events_unit_id_idx")
|
|
2780
|
+
@@index([purchased_hiring_unit_id, effective_at], map: "purchased_hu_assignment_events_unit_effective_idx")
|
|
2781
|
+
@@map("purchased_hiring_unit_assignment_events")
|
|
2782
|
+
@@schema("licensing")
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
/// Product catalogue: one wide row per (code, version) with fixed per-hiring-unit entitlements.
|
|
2786
|
+
/// See eagles-db/docs/eagles-db/licensing-catalog.md for column → usage metric_key mapping at purchase.
|
|
2787
|
+
model LicensePackage {
|
|
2788
|
+
id String @id @default(uuid())
|
|
2789
|
+
code String
|
|
2790
|
+
version Int
|
|
2791
|
+
name String
|
|
2792
|
+
description String?
|
|
2793
|
+
price Decimal @db.Decimal(18, 2)
|
|
2794
|
+
/// Internal cost of the package. Same currency as `currency`. Not for org-facing catalogue APIs.
|
|
2795
|
+
cost_price Decimal @default(0) @db.Decimal(18, 2)
|
|
2796
|
+
currency String @default("INR")
|
|
2797
|
+
status LicensePackageStatus @default(DRAFT)
|
|
2798
|
+
/// Number of PurchasedHiringUnit rows created per package purchase.
|
|
2799
|
+
units_per_purchase Int
|
|
2800
|
+
|
|
2801
|
+
/// Per-hiring-unit entitlements. null = not included; 0 = explicitly zero.
|
|
2802
|
+
interview_ai_assisted_hours Decimal? @db.Decimal(20, 4)
|
|
2803
|
+
interview_full_ai_hours Decimal? @db.Decimal(20, 4)
|
|
2804
|
+
interview_non_ai_hours Decimal? @db.Decimal(20, 4)
|
|
2805
|
+
assignment_count Decimal? @db.Decimal(20, 4)
|
|
2806
|
+
test_count Decimal? @db.Decimal(20, 4)
|
|
2807
|
+
resume_count Decimal? @db.Decimal(20, 4)
|
|
2808
|
+
credits Decimal? @db.Decimal(20, 4)
|
|
2809
|
+
|
|
2810
|
+
created_at DateTime @default(now())
|
|
2811
|
+
updated_at DateTime @updatedAt
|
|
2812
|
+
created_by String
|
|
2813
|
+
updated_by String
|
|
2814
|
+
is_active Boolean @default(true)
|
|
2815
|
+
|
|
2816
|
+
purchased_license_packages PurchasedLicensePackage[]
|
|
2817
|
+
organisations LicensePackageOrganisation[]
|
|
2818
|
+
|
|
2819
|
+
@@unique([code, version])
|
|
2820
|
+
@@index([code])
|
|
2821
|
+
@@index([status])
|
|
2822
|
+
@@map("license_packages")
|
|
2823
|
+
@@schema("licensing")
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
/// Many-to-many: which organisations may see this catalogue package.
|
|
2827
|
+
/// Zero rows = visible to nobody except platform list (enforced later in eagles-backend).
|
|
2828
|
+
model LicensePackageOrganisation {
|
|
2829
|
+
id String @id @default(uuid())
|
|
2830
|
+
license_package_id String
|
|
2831
|
+
organisation_id String
|
|
2832
|
+
|
|
2833
|
+
created_at DateTime @default(now())
|
|
2834
|
+
updated_at DateTime @updatedAt
|
|
2835
|
+
created_by String
|
|
2836
|
+
updated_by String
|
|
2837
|
+
is_active Boolean @default(true)
|
|
2838
|
+
|
|
2839
|
+
license_package LicensePackage @relation(fields: [license_package_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2840
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2841
|
+
|
|
2842
|
+
@@unique([license_package_id, organisation_id], map: "license_package_orgs_pkg_org_key")
|
|
2843
|
+
@@index([organisation_id])
|
|
2844
|
+
@@map("license_package_organisations")
|
|
2845
|
+
@@schema("licensing")
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
enum LicensePackageStatus {
|
|
2849
|
+
DRAFT
|
|
2850
|
+
ACTIVE
|
|
2851
|
+
ARCHIVED
|
|
2852
|
+
|
|
2853
|
+
@@schema("licensing")
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
enum PurchasedLicensePackageStatus {
|
|
2857
|
+
ACTIVE
|
|
2858
|
+
EXPIRED
|
|
2859
|
+
CANCELLED
|
|
2860
|
+
|
|
2861
|
+
@@schema("licensing")
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2864
|
+
enum PurchasedHiringUnitStatus {
|
|
2865
|
+
AVAILABLE
|
|
2866
|
+
ASSIGNED
|
|
2867
|
+
ACTIVE
|
|
2868
|
+
EXPIRED
|
|
2869
|
+
|
|
2870
|
+
@@schema("licensing")
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
enum PurchasedTopUpStatus {
|
|
2874
|
+
ACTIVE
|
|
2875
|
+
DEPLETED
|
|
2876
|
+
CANCELLED
|
|
2877
|
+
|
|
2878
|
+
@@schema("licensing")
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
enum PurchasedHiringUnitAssignmentEventKind {
|
|
2882
|
+
DEPARTMENT_ASSIGNED
|
|
2883
|
+
DEPARTMENT_UNASSIGNED
|
|
2884
|
+
JOB_LINKED
|
|
2885
|
+
JOB_UNLINKED
|
|
2886
|
+
|
|
2887
|
+
@@schema("licensing")
|
|
2888
|
+
}
|
|
2889
|
+
|
|
2890
|
+
enum LicensingLedgerEntitlementType {
|
|
2891
|
+
INTERVIEW_AI_ASSISTED_HOURS
|
|
2892
|
+
INTERVIEW_FULL_AI_HOURS
|
|
2893
|
+
INTERVIEW_NON_AI_HOURS
|
|
2894
|
+
ASSIGNMENT_COUNT
|
|
2895
|
+
TEST_COUNT
|
|
2896
|
+
RESUME_COUNT
|
|
2897
|
+
CREDITS
|
|
2898
|
+
|
|
2899
|
+
@@schema("licensing")
|
|
2900
|
+
}
|
|
2901
|
+
|
|
2902
|
+
enum LicensingLedgerDirection {
|
|
2903
|
+
CREDIT
|
|
2904
|
+
DEBIT
|
|
2905
|
+
|
|
2906
|
+
@@schema("licensing")
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
enum LicensingLedgerReason {
|
|
2910
|
+
PURCHASE
|
|
2911
|
+
TOP_UP
|
|
2912
|
+
USAGE
|
|
2913
|
+
ADJUSTMENT
|
|
2914
|
+
REFUND
|
|
2915
|
+
EXPIRY
|
|
2916
|
+
|
|
2917
|
+
@@schema("licensing")
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
enum AiCostLedgerReason {
|
|
2921
|
+
PURCHASE
|
|
2922
|
+
USAGE
|
|
2923
|
+
ADJUSTMENT
|
|
2924
|
+
REFUND
|
|
2925
|
+
|
|
2926
|
+
@@schema("licensing")
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
/// Append-only book of hiring-unit entitlement movements.
|
|
2930
|
+
/// remaining(unit, type) = SUM(CREDIT amount) - SUM(DEBIT amount).
|
|
2931
|
+
/// See eagles-db/docs/eagles-db/licensing-hiring-unit.md.
|
|
2932
|
+
model LicensingLedgerEntry {
|
|
2933
|
+
id String @id @default(uuid())
|
|
2934
|
+
organisation_id String
|
|
2935
|
+
/// Null for org-level rows (e.g. unallocated top-ups later).
|
|
2936
|
+
purchased_hiring_unit_id String?
|
|
2937
|
+
entitlement_type LicensingLedgerEntitlementType
|
|
2938
|
+
direction LicensingLedgerDirection
|
|
2939
|
+
/// Always non-negative. CREDIT of 0 means the stem is included at zero.
|
|
2940
|
+
amount Decimal @db.Decimal(20, 4)
|
|
2941
|
+
reason LicensingLedgerReason
|
|
2942
|
+
occurred_at DateTime @default(now())
|
|
2943
|
+
source_type String?
|
|
2944
|
+
source_id String?
|
|
2945
|
+
description String?
|
|
2946
|
+
idempotency_key String @unique
|
|
2947
|
+
created_at DateTime @default(now())
|
|
2948
|
+
updated_at DateTime @default(now()) @updatedAt
|
|
2949
|
+
created_by String
|
|
2950
|
+
updated_by String
|
|
2951
|
+
is_active Boolean @default(true)
|
|
2952
|
+
|
|
2953
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2954
|
+
purchased_hiring_unit PurchasedHiringUnit? @relation(fields: [purchased_hiring_unit_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2955
|
+
|
|
2956
|
+
@@index([purchased_hiring_unit_id, entitlement_type, occurred_at], map: "licensing_ledger_unit_type_occurred_idx")
|
|
2957
|
+
@@index([organisation_id, entitlement_type, occurred_at], map: "licensing_ledger_org_type_occurred_idx")
|
|
2958
|
+
@@map("licensing_ledger")
|
|
2959
|
+
@@schema("licensing")
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
/// Historical package purchase by an organisation (independent per transaction).
|
|
2963
|
+
model PurchasedLicensePackage {
|
|
2964
|
+
id String @id @default(uuid())
|
|
2965
|
+
organisation_id String
|
|
2966
|
+
license_package_id String
|
|
2967
|
+
/// Snapshot of catalogue identity at purchase time.
|
|
2968
|
+
package_code String
|
|
2969
|
+
package_version Int
|
|
2970
|
+
package_name String
|
|
2971
|
+
price Decimal @db.Decimal(18, 2)
|
|
2972
|
+
currency String @default("INR")
|
|
2973
|
+
units_per_purchase Int
|
|
2974
|
+
/// How many package instances were bought in this transaction.
|
|
2975
|
+
package_quantity Int @default(1)
|
|
2976
|
+
purchased_at DateTime @default(now())
|
|
2977
|
+
status PurchasedLicensePackageStatus @default(ACTIVE)
|
|
2978
|
+
created_at DateTime @default(now())
|
|
2979
|
+
updated_at DateTime @updatedAt
|
|
2980
|
+
created_by String
|
|
2981
|
+
updated_by String
|
|
2982
|
+
is_active Boolean @default(true)
|
|
2983
|
+
|
|
2984
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2985
|
+
license_package LicensePackage @relation(fields: [license_package_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2986
|
+
hiring_units PurchasedHiringUnit[]
|
|
2987
|
+
|
|
2988
|
+
@@index([organisation_id])
|
|
2989
|
+
@@index([organisation_id, status])
|
|
2990
|
+
@@index([organisation_id, purchased_at])
|
|
2991
|
+
@@map("purchased_license_packages")
|
|
2992
|
+
@@schema("licensing")
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2995
|
+
/// Runtime hiring unit identity and allocation. Entitlement balances live on
|
|
2996
|
+
/// `licensing.licensing_ledger` (Prisma model `LicensingLedgerEntry`).
|
|
2997
|
+
/// See eagles-db/docs/eagles-db/licensing-hiring-unit.md.
|
|
2998
|
+
model PurchasedHiringUnit {
|
|
2999
|
+
id String @id @default(uuid())
|
|
3000
|
+
organisation_id String
|
|
3001
|
+
purchased_license_package_id String
|
|
3002
|
+
status PurchasedHiringUnitStatus @default(AVAILABLE)
|
|
3003
|
+
/// Current department allocation (licensing allocation, not hiring manager).
|
|
3004
|
+
department_id String?
|
|
3005
|
+
/// Set once when department_id is first assigned; not cleared on reassignment.
|
|
3006
|
+
first_assigned_at DateTime?
|
|
3007
|
+
/// Optional unit expiry.
|
|
3008
|
+
expiry_at DateTime?
|
|
3009
|
+
/// Optional job association (distinct from JobDescription.hiring_manager_id).
|
|
3010
|
+
job_description_id String?
|
|
3011
|
+
|
|
3012
|
+
created_at DateTime @default(now())
|
|
3013
|
+
updated_at DateTime @updatedAt
|
|
3014
|
+
created_by String
|
|
3015
|
+
updated_by String
|
|
3016
|
+
is_active Boolean @default(true)
|
|
3017
|
+
|
|
3018
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3019
|
+
purchased_license_package PurchasedLicensePackage @relation(fields: [purchased_license_package_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3020
|
+
department Department? @relation(fields: [department_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
3021
|
+
job_description JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
3022
|
+
assignment_events PurchasedHiringUnitAssignmentEvent[]
|
|
3023
|
+
ledger_entries LicensingLedgerEntry[]
|
|
3024
|
+
ai_cost_ledger_entries AiCostLedgerEntry[]
|
|
3025
|
+
|
|
3026
|
+
@@index([organisation_id])
|
|
3027
|
+
@@index([purchased_license_package_id])
|
|
3028
|
+
@@index([department_id])
|
|
3029
|
+
@@index([job_description_id])
|
|
3030
|
+
@@index([organisation_id, status])
|
|
3031
|
+
@@index([organisation_id, department_id])
|
|
3032
|
+
@@index([organisation_id, job_description_id])
|
|
3033
|
+
@@map("purchased_hiring_units")
|
|
3034
|
+
@@schema("licensing")
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3037
|
+
/// Wide top-up purchase: org-level per-metric pool (purchased / remaining) before allocation to hiring units.
|
|
3038
|
+
model PurchasedTopUp {
|
|
3039
|
+
id String @id @default(uuid())
|
|
3040
|
+
organisation_id String
|
|
3041
|
+
purchased_at DateTime @default(now())
|
|
3042
|
+
status PurchasedTopUpStatus @default(ACTIVE)
|
|
3043
|
+
total_price Decimal? @db.Decimal(18, 2)
|
|
3044
|
+
currency String? @default("INR")
|
|
3045
|
+
description String?
|
|
3046
|
+
|
|
3047
|
+
interview_ai_assisted_hours_purchased Decimal? @db.Decimal(20, 4)
|
|
3048
|
+
interview_full_ai_hours_purchased Decimal? @db.Decimal(20, 4)
|
|
3049
|
+
interview_non_ai_hours_purchased Decimal? @db.Decimal(20, 4)
|
|
3050
|
+
assignment_count_purchased Decimal? @db.Decimal(20, 4)
|
|
3051
|
+
test_count_purchased Decimal? @db.Decimal(20, 4)
|
|
3052
|
+
resume_count_purchased Decimal? @db.Decimal(20, 4)
|
|
3053
|
+
credits_purchased Decimal? @db.Decimal(20, 4)
|
|
3054
|
+
|
|
3055
|
+
interview_ai_assisted_hours_remaining Decimal? @db.Decimal(20, 4)
|
|
3056
|
+
interview_full_ai_hours_remaining Decimal? @db.Decimal(20, 4)
|
|
3057
|
+
interview_non_ai_hours_remaining Decimal? @db.Decimal(20, 4)
|
|
3058
|
+
assignment_count_remaining Decimal? @db.Decimal(20, 4)
|
|
3059
|
+
test_count_remaining Decimal? @db.Decimal(20, 4)
|
|
3060
|
+
resume_count_remaining Decimal? @db.Decimal(20, 4)
|
|
3061
|
+
credits_remaining Decimal? @db.Decimal(20, 4)
|
|
3062
|
+
|
|
3063
|
+
created_at DateTime @default(now())
|
|
3064
|
+
updated_at DateTime @updatedAt
|
|
3065
|
+
created_by String
|
|
3066
|
+
updated_by String
|
|
3067
|
+
is_active Boolean @default(true)
|
|
3068
|
+
|
|
3069
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3070
|
+
|
|
3071
|
+
@@index([organisation_id])
|
|
3072
|
+
@@index([organisation_id, status])
|
|
3073
|
+
@@map("purchased_top_ups")
|
|
3074
|
+
@@schema("licensing")
|
|
3075
|
+
}
|
|
3076
|
+
|
|
2727
3077
|
model LiveAnalysis {
|
|
2728
3078
|
id String @id @default(uuid())
|
|
2729
3079
|
//foreign keys
|
|
@@ -3146,65 +3496,73 @@ enum OrganisationSize {
|
|
|
3146
3496
|
}
|
|
3147
3497
|
|
|
3148
3498
|
model Organisation {
|
|
3149
|
-
id
|
|
3150
|
-
name
|
|
3151
|
-
industry
|
|
3152
|
-
about
|
|
3153
|
-
website
|
|
3154
|
-
size
|
|
3155
|
-
phone
|
|
3156
|
-
address
|
|
3157
|
-
company_values
|
|
3158
|
-
allowed_email_domains
|
|
3159
|
-
send_email
|
|
3160
|
-
interviewers
|
|
3161
|
-
created_at
|
|
3162
|
-
updated_at
|
|
3163
|
-
created_by
|
|
3164
|
-
updated_by
|
|
3165
|
-
is_active
|
|
3166
|
-
alias
|
|
3167
|
-
logo
|
|
3168
|
-
job_sequence
|
|
3169
|
-
employee_sequence
|
|
3170
|
-
applications
|
|
3171
|
-
user_roles
|
|
3172
|
-
job_descriptions
|
|
3173
|
-
job_profiles
|
|
3174
|
-
assessment_library
|
|
3175
|
-
assignment_library
|
|
3176
|
-
interviews
|
|
3177
|
-
assignments
|
|
3178
|
-
fit_check
|
|
3179
|
-
resumes
|
|
3180
|
-
approvals
|
|
3181
|
-
suggestions
|
|
3182
|
-
ongoing_evaluations
|
|
3183
|
-
actions
|
|
3184
|
-
integration_credentials
|
|
3185
|
-
zoho_sync_mappings
|
|
3186
|
-
assessments
|
|
3187
|
-
timezone
|
|
3499
|
+
id String @id @default(uuid())
|
|
3500
|
+
name String @unique
|
|
3501
|
+
industry String
|
|
3502
|
+
about String
|
|
3503
|
+
website String
|
|
3504
|
+
size OrganisationSize @default(ONE_TO_TEN)
|
|
3505
|
+
phone String
|
|
3506
|
+
address String
|
|
3507
|
+
company_values Json[]
|
|
3508
|
+
allowed_email_domains String[]
|
|
3509
|
+
send_email Boolean @default(true)
|
|
3510
|
+
interviewers User[]
|
|
3511
|
+
created_at DateTime @default(now())
|
|
3512
|
+
updated_at DateTime @updatedAt
|
|
3513
|
+
created_by String
|
|
3514
|
+
updated_by String
|
|
3515
|
+
is_active Boolean @default(true)
|
|
3516
|
+
alias String? @unique
|
|
3517
|
+
logo String?
|
|
3518
|
+
job_sequence Int @default(1)
|
|
3519
|
+
employee_sequence Int @default(1)
|
|
3520
|
+
applications Application[]
|
|
3521
|
+
user_roles UserRole[]
|
|
3522
|
+
job_descriptions JobDescription[]
|
|
3523
|
+
job_profiles JobProfile[]
|
|
3524
|
+
assessment_library AssessmentLibrary[]
|
|
3525
|
+
assignment_library AssignmentLibrary[]
|
|
3526
|
+
interviews Interview[]
|
|
3527
|
+
assignments Assignment[]
|
|
3528
|
+
fit_check FitCheck[] // one-to-many link
|
|
3529
|
+
resumes Resume[] // one-to-many link
|
|
3530
|
+
approvals Approval[] // one-to-many link
|
|
3531
|
+
suggestions Suggestion[]
|
|
3532
|
+
ongoing_evaluations OngoingEvaluation[] // optional one-to-many
|
|
3533
|
+
actions Action[]
|
|
3534
|
+
integration_credentials IntegrationCredential[]
|
|
3535
|
+
zoho_sync_mappings ZohoSyncMapping[]
|
|
3536
|
+
assessments Assessment[]
|
|
3537
|
+
timezone String @default("Asia/Kolkata")
|
|
3188
3538
|
/// ISO 3166-1 alpha-2 (e.g. IN).
|
|
3189
|
-
country_code
|
|
3190
|
-
organisation_configs
|
|
3191
|
-
activity_events
|
|
3192
|
-
usage_ledger_entries
|
|
3193
|
-
usage_aggregates
|
|
3194
|
-
channel_provider_configs
|
|
3195
|
-
conversations
|
|
3196
|
-
communication_messages
|
|
3197
|
-
job_application_fields
|
|
3198
|
-
documents
|
|
3199
|
-
job_application_templates
|
|
3200
|
-
offer_letter_templates
|
|
3201
|
-
offers
|
|
3202
|
-
sources
|
|
3203
|
-
evaluation_criteria
|
|
3204
|
-
departments
|
|
3205
|
-
hiring_plans
|
|
3206
|
-
employees
|
|
3207
|
-
competency_dictionaries
|
|
3539
|
+
country_code String @default("IN")
|
|
3540
|
+
organisation_configs OrganisationConfig[]
|
|
3541
|
+
activity_events ActivityEvent[]
|
|
3542
|
+
usage_ledger_entries UsageLedgerEntry[]
|
|
3543
|
+
usage_aggregates UsageAggregate[]
|
|
3544
|
+
channel_provider_configs ChannelProviderConfig[]
|
|
3545
|
+
conversations Conversation[]
|
|
3546
|
+
communication_messages CommunicationMessage[]
|
|
3547
|
+
job_application_fields JobApplicationField[]
|
|
3548
|
+
documents Document[]
|
|
3549
|
+
job_application_templates JobApplicationTemplate[]
|
|
3550
|
+
offer_letter_templates OfferLetterTemplate[]
|
|
3551
|
+
offers Offer[]
|
|
3552
|
+
sources Source[]
|
|
3553
|
+
evaluation_criteria EvaluationCriteria[]
|
|
3554
|
+
departments Department[]
|
|
3555
|
+
hiring_plans HiringPlan[]
|
|
3556
|
+
employees Employee[]
|
|
3557
|
+
competency_dictionaries CompetencyDictionary[]
|
|
3558
|
+
billing_transactions BillingTransaction[]
|
|
3559
|
+
payment_webhook_events PaymentWebhookEvent[]
|
|
3560
|
+
purchased_license_packages PurchasedLicensePackage[]
|
|
3561
|
+
purchased_hiring_units PurchasedHiringUnit[]
|
|
3562
|
+
purchased_top_ups PurchasedTopUp[]
|
|
3563
|
+
licensing_ledger_entries LicensingLedgerEntry[]
|
|
3564
|
+
license_package_organisations LicensePackageOrganisation[]
|
|
3565
|
+
ai_cost_ledger_entries AiCostLedgerEntry[]
|
|
3208
3566
|
|
|
3209
3567
|
@@index([name])
|
|
3210
3568
|
@@schema("public")
|
|
@@ -3224,6 +3582,119 @@ model OrganisationConfig {
|
|
|
3224
3582
|
@@schema("public")
|
|
3225
3583
|
}
|
|
3226
3584
|
|
|
3585
|
+
// PAYMENT SERVICE boundary — portable payment microservice owns these enums/columns.
|
|
3586
|
+
|
|
3587
|
+
enum BillingTransactionStatus {
|
|
3588
|
+
INITIATED
|
|
3589
|
+
ORDER_CREATED
|
|
3590
|
+
PAYMENT_PENDING
|
|
3591
|
+
SUCCESS
|
|
3592
|
+
FAILED
|
|
3593
|
+
CANCELLED
|
|
3594
|
+
REFUND_PENDING
|
|
3595
|
+
REFUND_FAILED
|
|
3596
|
+
REFUNDED
|
|
3597
|
+
|
|
3598
|
+
@@schema("public")
|
|
3599
|
+
}
|
|
3600
|
+
|
|
3601
|
+
enum BillingTransactionType {
|
|
3602
|
+
PURCHASE
|
|
3603
|
+
TOP_UP
|
|
3604
|
+
REFUND
|
|
3605
|
+
|
|
3606
|
+
@@schema("public")
|
|
3607
|
+
}
|
|
3608
|
+
|
|
3609
|
+
enum BillingTransactionFailureCategory {
|
|
3610
|
+
RAZORPAY_ORDER
|
|
3611
|
+
RAZORPAY_PAYMENT
|
|
3612
|
+
REFUND
|
|
3613
|
+
INTERNAL
|
|
3614
|
+
|
|
3615
|
+
@@schema("public")
|
|
3616
|
+
}
|
|
3617
|
+
|
|
3618
|
+
/// Payment reconciliation state when Treadspace status is FAILED but Razorpay captured payment.
|
|
3619
|
+
enum BillingPaymentMismatchStatus {
|
|
3620
|
+
DETECTED
|
|
3621
|
+
UNFULFILLED
|
|
3622
|
+
|
|
3623
|
+
@@schema("public")
|
|
3624
|
+
}
|
|
3625
|
+
|
|
3626
|
+
/// Financial transaction lifecycle for organisation billing purchases.
|
|
3627
|
+
model BillingTransaction {
|
|
3628
|
+
id String @id @default(uuid())
|
|
3629
|
+
organisation_id String
|
|
3630
|
+
/// Opaque plan/product identity supplied at checkout. Not a catalog FK.
|
|
3631
|
+
purchase_reference String
|
|
3632
|
+
/// Human-readable snapshot captured at checkout for invoices and receipts.
|
|
3633
|
+
purchase_display_name String?
|
|
3634
|
+
transaction_type BillingTransactionType
|
|
3635
|
+
status BillingTransactionStatus @default(INITIATED)
|
|
3636
|
+
failure_category BillingTransactionFailureCategory?
|
|
3637
|
+
/// Human-readable or provider detail (e.g. Razorpay error_description).
|
|
3638
|
+
failure_reason String?
|
|
3639
|
+
amount Int
|
|
3640
|
+
currency String @default("INR")
|
|
3641
|
+
razorpay_order_id String?
|
|
3642
|
+
razorpay_payment_id String? @unique
|
|
3643
|
+
/// Razorpay payment method at capture (card, netbanking, upi, wallet, etc.).
|
|
3644
|
+
payment_method String?
|
|
3645
|
+
razorpay_subscription_id String?
|
|
3646
|
+
razorpay_refund_id String?
|
|
3647
|
+
refund_reason String?
|
|
3648
|
+
refund_amount Int?
|
|
3649
|
+
idempotency_key String @unique
|
|
3650
|
+
invoice_number String? @unique
|
|
3651
|
+
/// Email of the org Admin who initiated checkout (bill-to).
|
|
3652
|
+
purchaser_email String?
|
|
3653
|
+
/// Set when FAILED but Razorpay order/payment is captured (reconciliation path).
|
|
3654
|
+
payment_mismatch_status BillingPaymentMismatchStatus?
|
|
3655
|
+
/// Strict same-intent SUCCESS transaction that fulfilled the purchase (UNFULFILLED only).
|
|
3656
|
+
payment_mismatch_fulfilled_by_id String?
|
|
3657
|
+
created_at DateTime @default(now())
|
|
3658
|
+
updated_at DateTime @updatedAt
|
|
3659
|
+
|
|
3660
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id])
|
|
3661
|
+
|
|
3662
|
+
@@index([organisation_id, status])
|
|
3663
|
+
@@index([purchase_reference])
|
|
3664
|
+
@@index([razorpay_order_id])
|
|
3665
|
+
@@map("billing_transactions")
|
|
3666
|
+
@@schema("public")
|
|
3667
|
+
}
|
|
3668
|
+
|
|
3669
|
+
enum PaymentWebhookEventStatus {
|
|
3670
|
+
RECEIVED
|
|
3671
|
+
PROCESSED
|
|
3672
|
+
FAILED
|
|
3673
|
+
|
|
3674
|
+
@@schema("public")
|
|
3675
|
+
}
|
|
3676
|
+
|
|
3677
|
+
/// Idempotent record of payment provider webhook deliveries.
|
|
3678
|
+
model PaymentWebhookEvent {
|
|
3679
|
+
id String @id @default(uuid())
|
|
3680
|
+
organisation_id String?
|
|
3681
|
+
provider String
|
|
3682
|
+
provider_event_id String
|
|
3683
|
+
event_type String
|
|
3684
|
+
status PaymentWebhookEventStatus @default(RECEIVED)
|
|
3685
|
+
billing_transaction_id String?
|
|
3686
|
+
error_message String?
|
|
3687
|
+
processed_at DateTime?
|
|
3688
|
+
created_at DateTime @default(now())
|
|
3689
|
+
|
|
3690
|
+
organisation Organisation? @relation(fields: [organisation_id], references: [id])
|
|
3691
|
+
|
|
3692
|
+
@@unique([provider, provider_event_id])
|
|
3693
|
+
@@index([status, created_at])
|
|
3694
|
+
@@map("payment_webhook_events")
|
|
3695
|
+
@@schema("public")
|
|
3696
|
+
}
|
|
3697
|
+
|
|
3227
3698
|
model Permission {
|
|
3228
3699
|
id String @id @default(uuid())
|
|
3229
3700
|
permissions String[] @default([])
|
|
@@ -3669,7 +4140,7 @@ datasource db {
|
|
|
3669
4140
|
provider = "postgresql"
|
|
3670
4141
|
url = env("DATABASE_URL")
|
|
3671
4142
|
|
|
3672
|
-
schemas = ["public", "analytics", "usage"]
|
|
4143
|
+
schemas = ["public", "analytics", "usage", "licensing"]
|
|
3673
4144
|
}
|
|
3674
4145
|
|
|
3675
4146
|
enum SourceCategory {
|