@adaptware/eagles-db 0.5.34 → 0.5.36
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 +15 -232
- package/client/index-browser.js +8 -226
- package/client/index.d.ts +87500 -107633
- package/client/index.js +15 -232
- package/client/package.json +1 -1
- package/client/schema.prisma +147 -490
- package/client/wasm.js +15 -232
- package/package.json +1 -1
- package/prisma/.DS_Store +0 -0
- package/prisma/schema/.DS_Store +0 -0
- package/prisma/schema/applications.prisma +34 -29
- package/prisma/schema/department.prisma +2 -3
- package/prisma/schema/document.prisma +1 -0
- package/prisma/schema/jobDescription.prisma +0 -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 +13 -0
- package/prisma/schema/organisation.prisma +0 -6
- package/prisma/schema/schema.prisma +1 -1
- package/client/libquery_engine-darwin.dylib.node +0 -0
- package/prisma/migrations/20260519120000_migrate_shortlisted_to_selected/migration.sql +0 -2
- package/prisma/schema/licensing/aiCostLedger.prisma +0 -34
- package/prisma/schema/licensing/assignmentHistory.prisma +0 -19
- package/prisma/schema/licensing/licensePackageCatalog.prisma +0 -62
- package/prisma/schema/licensing/licensingEnums.prisma +0 -80
- package/prisma/schema/licensing/licensingLedger.prisma +0 -32
- package/prisma/schema/licensing/purchasedLicense.prisma +0 -74
- package/prisma/schema/licensing/purchasedTopUp.prisma +0 -39
- package/prisma/schema/migrations/20260519120000_add_analytics_schema/migration.sql +0 -84
- package/prisma/schema/migrations/20260625120000_add_interviewer_analytics/migration.sql +0 -26
- package/prisma/schema/migrations/20260629120000_add_user_lifecycle_activity_events/migration.sql +0 -13
- package/prisma/schema/migrations/20260629140000_drop_organisation_org_code/migration.sql +0 -2
- package/prisma/schema/migrations/20260629160000_employee_codes_dual_interviewer_analytics/migration.sql +0 -87
- package/prisma/schema/migrations/20260630120000_add_application_sources/migration.sql +0 -38
- package/prisma/schema/migrations/20260701120000_add_source_effectiveness_analytics/migration.sql +0 -40
- package/prisma/schema/migrations/20260702120000_add_analytics_daily_tables/migration.sql +0 -232
- package/prisma/schema/migrations/20260716120000_evaluation_category_four_values/migration.sql +0 -204
- package/prisma/schema/migrations/20260716130000_application_withdrawn_analytics/migration.sql +0 -31
- package/prisma/schema/migrations/20260804120000_contact_us_optional_website_subject/migration.sql +0 -3
- package/prisma/schema/migrations/20260810120000_add_licensing_schema/migration.sql +0 -237
- package/prisma/schema/migrations/20260814153000_add_licensing_ledger/migration.sql +0 -236
- package/prisma/schema/migrations/20260828120000_license_package_orgs_cost_price_ai_cost_ledger/migration.sql +0 -74
- package/prisma/schema/migrations/20260831120000_ai_cost_ledger_purchase_reason/migration.sql +0 -2
- package/prisma/schema/migrations/20260831140000_ai_cost_ledger_nullable_hiring_unit/migration.sql +0 -3
package/client/schema.prisma
CHANGED
|
@@ -414,49 +414,53 @@ 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
|
|
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)
|
|
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
|
+
|
|
451
455
|
/// Relations
|
|
452
|
-
evaluation_plan EvaluationPlan?
|
|
453
|
-
candidate User
|
|
454
|
-
organisation Organisation
|
|
455
|
-
resume Resume
|
|
456
|
-
job_description JobDescription
|
|
456
|
+
evaluation_plan EvaluationPlan? @relation(fields: [evaluation_plan_id], references: [id])
|
|
457
|
+
candidate User @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
458
|
+
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
459
|
+
resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
460
|
+
job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
457
461
|
fit_check FitCheck?
|
|
458
|
-
recruiter User?
|
|
459
|
-
source Source?
|
|
462
|
+
recruiter User? @relation("ApplicationRecruiter", fields: [recruiter_id], references: [id])
|
|
463
|
+
source Source? @relation(fields: [source_id], references: [id], onDelete: SetNull)
|
|
460
464
|
interviews Interview[]
|
|
461
465
|
assignments Assignment[]
|
|
462
466
|
ongoing_evaluations OngoingEvaluation[]
|
|
@@ -466,6 +470,7 @@ model Application {
|
|
|
466
470
|
communication_messages CommunicationMessage[]
|
|
467
471
|
job_application_responses JobApplicationResponse[]
|
|
468
472
|
offer Offer?
|
|
473
|
+
fit_check_report_document Document? @relation("ApplicationFitCheckReportDocument", fields: [fit_check_report_document_id], references: [id], onDelete: SetNull)
|
|
469
474
|
|
|
470
475
|
@@unique([candidate_id, job_description_id]) // Ensures candidate applies only once per job
|
|
471
476
|
@@index([candidate_id])
|
|
@@ -1193,6 +1198,8 @@ enum CompetencyCategory {
|
|
|
1193
1198
|
TECHNICAL
|
|
1194
1199
|
BEHAVIOURAL
|
|
1195
1200
|
AI
|
|
1201
|
+
/// FitCheck analysis only — not a dictionary / job-profile catalog category.
|
|
1202
|
+
EXPERIENCE_RELEVANCE
|
|
1196
1203
|
|
|
1197
1204
|
@@schema("public")
|
|
1198
1205
|
}
|
|
@@ -1277,25 +1284,24 @@ enum HiringPlanSectionStatus {
|
|
|
1277
1284
|
/// Replaces the free-text `business_unit` string on HiringPlanLine / Employee.
|
|
1278
1285
|
/// Headship lives on DepartmentMember.is_head (at most one per dept, enforced in service).
|
|
1279
1286
|
model Department {
|
|
1280
|
-
id
|
|
1281
|
-
organisation_id
|
|
1282
|
-
name
|
|
1283
|
-
code
|
|
1287
|
+
id String @id @default(uuid())
|
|
1288
|
+
organisation_id String
|
|
1289
|
+
name String
|
|
1290
|
+
code String?
|
|
1284
1291
|
/// Global display order across departments within the org (drag-reorder in plan grid).
|
|
1285
|
-
sort_order
|
|
1286
|
-
created_at
|
|
1287
|
-
updated_at
|
|
1288
|
-
created_by
|
|
1289
|
-
updated_by
|
|
1290
|
-
is_active
|
|
1291
|
-
organisation
|
|
1292
|
-
members
|
|
1293
|
-
hiring_plan_lines
|
|
1294
|
-
employees
|
|
1295
|
-
job_descriptions
|
|
1296
|
-
job_profiles
|
|
1297
|
-
sections
|
|
1298
|
-
assigned_hiring_units PurchasedHiringUnit[]
|
|
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[]
|
|
1299
1305
|
|
|
1300
1306
|
@@unique([organisation_id, name])
|
|
1301
1307
|
@@index([organisation_id])
|
|
@@ -1399,6 +1405,7 @@ model Document {
|
|
|
1399
1405
|
offer_letters OfferLetter[] @relation("OfferLetterPdf")
|
|
1400
1406
|
offer_letter_template_snapshots OfferLetter[] @relation("OfferLetterTemplateSnapshot")
|
|
1401
1407
|
offer_draft_edited_html Offer[] @relation("OfferDraftEditedHtml")
|
|
1408
|
+
application_fit_check_report Application? @relation("ApplicationFitCheckReportDocument")
|
|
1402
1409
|
|
|
1403
1410
|
// Indexes
|
|
1404
1411
|
@@index([candidate_id])
|
|
@@ -1567,33 +1574,35 @@ enum FitCheckStatus {
|
|
|
1567
1574
|
|
|
1568
1575
|
model FitCheck {
|
|
1569
1576
|
/// Primary key (UUID)
|
|
1570
|
-
id
|
|
1577
|
+
id String @id @default(uuid())
|
|
1571
1578
|
/// FK to organisations table
|
|
1572
|
-
organisation_id
|
|
1573
|
-
candidate_id
|
|
1574
|
-
resume_id
|
|
1575
|
-
job_description_id
|
|
1579
|
+
organisation_id String?
|
|
1580
|
+
candidate_id String?
|
|
1581
|
+
resume_id String
|
|
1582
|
+
job_description_id String
|
|
1576
1583
|
/// Owning application (inverted from Application.fit_check_id)
|
|
1577
|
-
application_id
|
|
1578
|
-
skills_analysis
|
|
1579
|
-
overall_analysis
|
|
1580
|
-
overall_score
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1584
|
+
application_id String? @unique
|
|
1585
|
+
skills_analysis Json?
|
|
1586
|
+
overall_analysis Json?
|
|
1587
|
+
overall_score Float
|
|
1588
|
+
/// Free-text from Overall Analysis agent; preferred over recommendation Json.
|
|
1589
|
+
overall_recommendation String?
|
|
1590
|
+
short_match_analysis Json[]
|
|
1591
|
+
fit_comparison Json?
|
|
1592
|
+
recommendation Json?
|
|
1593
|
+
competencies_analysis Json?
|
|
1585
1594
|
/// Audit fields
|
|
1586
|
-
created_by
|
|
1587
|
-
updated_by
|
|
1588
|
-
is_active
|
|
1589
|
-
created_at
|
|
1590
|
-
updated_at
|
|
1595
|
+
created_by String
|
|
1596
|
+
updated_by String
|
|
1597
|
+
is_active Boolean @default(true)
|
|
1598
|
+
created_at DateTime @default(now())
|
|
1599
|
+
updated_at DateTime @updatedAt
|
|
1591
1600
|
/// Relations
|
|
1592
|
-
organisation
|
|
1593
|
-
candidate
|
|
1594
|
-
resume
|
|
1595
|
-
job_description
|
|
1596
|
-
application
|
|
1601
|
+
organisation Organisation? @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1602
|
+
candidate User? @relation(fields: [candidate_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1603
|
+
resume Resume @relation(fields: [resume_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1604
|
+
job_description JobDescription @relation(fields: [job_description_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1605
|
+
application Application? @relation(fields: [application_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1597
1606
|
|
|
1598
1607
|
/// Ensure one FitCheck per (resume_id, job_description_id) pair
|
|
1599
1608
|
@@unique([resume_id, job_description_id])
|
|
@@ -2530,7 +2539,6 @@ model JobDescription {
|
|
|
2530
2539
|
hiring_plan_line HiringPlanLine? @relation("PlanLineRequisitions", fields: [hiring_plan_line_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
2531
2540
|
/// Plan lines that use this JD as the role template/reference.
|
|
2532
2541
|
referenced_by_plan_lines HiringPlanLine[] @relation("PlanLineTemplateJd")
|
|
2533
|
-
linked_hiring_units PurchasedHiringUnit[]
|
|
2534
2542
|
|
|
2535
2543
|
@@index([organisation_id])
|
|
2536
2544
|
@@index([hiring_manager_id])
|
|
@@ -2722,353 +2730,6 @@ model JobRoundAnalyticsDaily {
|
|
|
2722
2730
|
@@schema("analytics")
|
|
2723
2731
|
}
|
|
2724
2732
|
|
|
2725
|
-
/// Append-only book of AI workflow cost (org pool, optionally a hiring unit).
|
|
2726
|
-
/// Covers every workflow (including license-included names). Amount is always USD.
|
|
2727
|
-
/// total_cost(unit) = SUM(DEBIT amount) - SUM(CREDIT amount) for that unit.
|
|
2728
|
-
/// CREDIT / PURCHASE is full package internal cost (USD) per hiring unit.
|
|
2729
|
-
/// DEBIT / USAGE is every workflow's Orion totalCost (USD), nothing excluded.
|
|
2730
|
-
model AiCostLedgerEntry {
|
|
2731
|
-
id String @id @default(uuid())
|
|
2732
|
-
organisation_id String
|
|
2733
|
-
purchased_hiring_unit_id String?
|
|
2734
|
-
workflow_name String
|
|
2735
|
-
direction LicensingLedgerDirection
|
|
2736
|
-
/// Always non-negative. USD.
|
|
2737
|
-
amount Decimal @db.Decimal(20, 4)
|
|
2738
|
-
reason AiCostLedgerReason
|
|
2739
|
-
occurred_at DateTime @default(now())
|
|
2740
|
-
source_type String?
|
|
2741
|
-
source_id String?
|
|
2742
|
-
description String?
|
|
2743
|
-
idempotency_key String @unique
|
|
2744
|
-
created_at DateTime @default(now())
|
|
2745
|
-
updated_at DateTime @default(now()) @updatedAt
|
|
2746
|
-
created_by String
|
|
2747
|
-
updated_by String
|
|
2748
|
-
is_active Boolean @default(true)
|
|
2749
|
-
|
|
2750
|
-
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2751
|
-
purchased_hiring_unit PurchasedHiringUnit? @relation(fields: [purchased_hiring_unit_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2752
|
-
|
|
2753
|
-
@@index([purchased_hiring_unit_id, occurred_at], map: "ai_cost_ledger_unit_occurred_idx")
|
|
2754
|
-
@@index([purchased_hiring_unit_id, workflow_name, occurred_at], map: "ai_cost_ledger_unit_workflow_occurred_idx")
|
|
2755
|
-
@@index([organisation_id, occurred_at], map: "ai_cost_ledger_org_occurred_idx")
|
|
2756
|
-
@@map("ai_cost_ledger")
|
|
2757
|
-
@@schema("licensing")
|
|
2758
|
-
}
|
|
2759
|
-
|
|
2760
|
-
/// Immutable assignment history for Hiring Unit department/job changes.
|
|
2761
|
-
model PurchasedHiringUnitAssignmentEvent {
|
|
2762
|
-
id String @id @default(uuid())
|
|
2763
|
-
purchased_hiring_unit_id String
|
|
2764
|
-
event_kind PurchasedHiringUnitAssignmentEventKind
|
|
2765
|
-
previous_department_id String?
|
|
2766
|
-
new_department_id String?
|
|
2767
|
-
previous_job_description_id String?
|
|
2768
|
-
new_job_description_id String?
|
|
2769
|
-
effective_at DateTime @default(now())
|
|
2770
|
-
created_by String
|
|
2771
|
-
|
|
2772
|
-
purchased_hiring_unit PurchasedHiringUnit @relation(fields: [purchased_hiring_unit_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2773
|
-
|
|
2774
|
-
@@index([purchased_hiring_unit_id], map: "purchased_hu_assignment_events_unit_id_idx")
|
|
2775
|
-
@@index([purchased_hiring_unit_id, effective_at], map: "purchased_hu_assignment_events_unit_effective_idx")
|
|
2776
|
-
@@map("purchased_hiring_unit_assignment_events")
|
|
2777
|
-
@@schema("licensing")
|
|
2778
|
-
}
|
|
2779
|
-
|
|
2780
|
-
/// Product catalogue: one wide row per (code, version) with fixed per-hiring-unit entitlements.
|
|
2781
|
-
/// See eagles-db/docs/eagles-db/licensing-catalog.md for column → usage metric_key mapping at purchase.
|
|
2782
|
-
model LicensePackage {
|
|
2783
|
-
id String @id @default(uuid())
|
|
2784
|
-
code String
|
|
2785
|
-
version Int
|
|
2786
|
-
name String
|
|
2787
|
-
description String?
|
|
2788
|
-
price Decimal @db.Decimal(18, 2)
|
|
2789
|
-
/// Internal cost of the package. Same currency as `currency`. Not for org-facing catalogue APIs.
|
|
2790
|
-
cost_price Decimal @default(0) @db.Decimal(18, 2)
|
|
2791
|
-
currency String @default("INR")
|
|
2792
|
-
status LicensePackageStatus @default(DRAFT)
|
|
2793
|
-
/// Number of PurchasedHiringUnit rows created per package purchase.
|
|
2794
|
-
units_per_purchase Int
|
|
2795
|
-
|
|
2796
|
-
/// Per-hiring-unit entitlements. null = not included; 0 = explicitly zero.
|
|
2797
|
-
interview_ai_assisted_hours Decimal? @db.Decimal(20, 4)
|
|
2798
|
-
interview_full_ai_hours Decimal? @db.Decimal(20, 4)
|
|
2799
|
-
interview_non_ai_hours Decimal? @db.Decimal(20, 4)
|
|
2800
|
-
assignment_count Decimal? @db.Decimal(20, 4)
|
|
2801
|
-
test_count Decimal? @db.Decimal(20, 4)
|
|
2802
|
-
resume_count Decimal? @db.Decimal(20, 4)
|
|
2803
|
-
credits Decimal? @db.Decimal(20, 4)
|
|
2804
|
-
|
|
2805
|
-
created_at DateTime @default(now())
|
|
2806
|
-
updated_at DateTime @updatedAt
|
|
2807
|
-
created_by String
|
|
2808
|
-
updated_by String
|
|
2809
|
-
is_active Boolean @default(true)
|
|
2810
|
-
|
|
2811
|
-
purchased_license_packages PurchasedLicensePackage[]
|
|
2812
|
-
organisations LicensePackageOrganisation[]
|
|
2813
|
-
|
|
2814
|
-
@@unique([code, version])
|
|
2815
|
-
@@index([code])
|
|
2816
|
-
@@index([status])
|
|
2817
|
-
@@map("license_packages")
|
|
2818
|
-
@@schema("licensing")
|
|
2819
|
-
}
|
|
2820
|
-
|
|
2821
|
-
/// Many-to-many: which organisations may see this catalogue package.
|
|
2822
|
-
/// Zero rows = visible to nobody except platform list (enforced later in eagles-backend).
|
|
2823
|
-
model LicensePackageOrganisation {
|
|
2824
|
-
id String @id @default(uuid())
|
|
2825
|
-
license_package_id String
|
|
2826
|
-
organisation_id String
|
|
2827
|
-
|
|
2828
|
-
created_at DateTime @default(now())
|
|
2829
|
-
updated_at DateTime @updatedAt
|
|
2830
|
-
created_by String
|
|
2831
|
-
updated_by String
|
|
2832
|
-
is_active Boolean @default(true)
|
|
2833
|
-
|
|
2834
|
-
license_package LicensePackage @relation(fields: [license_package_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2835
|
-
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2836
|
-
|
|
2837
|
-
@@unique([license_package_id, organisation_id], map: "license_package_orgs_pkg_org_key")
|
|
2838
|
-
@@index([organisation_id])
|
|
2839
|
-
@@map("license_package_organisations")
|
|
2840
|
-
@@schema("licensing")
|
|
2841
|
-
}
|
|
2842
|
-
|
|
2843
|
-
enum LicensePackageStatus {
|
|
2844
|
-
DRAFT
|
|
2845
|
-
ACTIVE
|
|
2846
|
-
ARCHIVED
|
|
2847
|
-
|
|
2848
|
-
@@schema("licensing")
|
|
2849
|
-
}
|
|
2850
|
-
|
|
2851
|
-
enum PurchasedLicensePackageStatus {
|
|
2852
|
-
ACTIVE
|
|
2853
|
-
EXPIRED
|
|
2854
|
-
CANCELLED
|
|
2855
|
-
|
|
2856
|
-
@@schema("licensing")
|
|
2857
|
-
}
|
|
2858
|
-
|
|
2859
|
-
enum PurchasedHiringUnitStatus {
|
|
2860
|
-
AVAILABLE
|
|
2861
|
-
ASSIGNED
|
|
2862
|
-
ACTIVE
|
|
2863
|
-
EXPIRED
|
|
2864
|
-
|
|
2865
|
-
@@schema("licensing")
|
|
2866
|
-
}
|
|
2867
|
-
|
|
2868
|
-
enum PurchasedTopUpStatus {
|
|
2869
|
-
ACTIVE
|
|
2870
|
-
DEPLETED
|
|
2871
|
-
CANCELLED
|
|
2872
|
-
|
|
2873
|
-
@@schema("licensing")
|
|
2874
|
-
}
|
|
2875
|
-
|
|
2876
|
-
enum PurchasedHiringUnitAssignmentEventKind {
|
|
2877
|
-
DEPARTMENT_ASSIGNED
|
|
2878
|
-
DEPARTMENT_UNASSIGNED
|
|
2879
|
-
JOB_LINKED
|
|
2880
|
-
JOB_UNLINKED
|
|
2881
|
-
|
|
2882
|
-
@@schema("licensing")
|
|
2883
|
-
}
|
|
2884
|
-
|
|
2885
|
-
enum LicensingLedgerEntitlementType {
|
|
2886
|
-
INTERVIEW_AI_ASSISTED_HOURS
|
|
2887
|
-
INTERVIEW_FULL_AI_HOURS
|
|
2888
|
-
INTERVIEW_NON_AI_HOURS
|
|
2889
|
-
ASSIGNMENT_COUNT
|
|
2890
|
-
TEST_COUNT
|
|
2891
|
-
RESUME_COUNT
|
|
2892
|
-
CREDITS
|
|
2893
|
-
|
|
2894
|
-
@@schema("licensing")
|
|
2895
|
-
}
|
|
2896
|
-
|
|
2897
|
-
enum LicensingLedgerDirection {
|
|
2898
|
-
CREDIT
|
|
2899
|
-
DEBIT
|
|
2900
|
-
|
|
2901
|
-
@@schema("licensing")
|
|
2902
|
-
}
|
|
2903
|
-
|
|
2904
|
-
enum LicensingLedgerReason {
|
|
2905
|
-
PURCHASE
|
|
2906
|
-
TOP_UP
|
|
2907
|
-
USAGE
|
|
2908
|
-
ADJUSTMENT
|
|
2909
|
-
REFUND
|
|
2910
|
-
EXPIRY
|
|
2911
|
-
|
|
2912
|
-
@@schema("licensing")
|
|
2913
|
-
}
|
|
2914
|
-
|
|
2915
|
-
enum AiCostLedgerReason {
|
|
2916
|
-
PURCHASE
|
|
2917
|
-
USAGE
|
|
2918
|
-
ADJUSTMENT
|
|
2919
|
-
REFUND
|
|
2920
|
-
|
|
2921
|
-
@@schema("licensing")
|
|
2922
|
-
}
|
|
2923
|
-
|
|
2924
|
-
/// Append-only book of hiring-unit entitlement movements.
|
|
2925
|
-
/// remaining(unit, type) = SUM(CREDIT amount) - SUM(DEBIT amount).
|
|
2926
|
-
/// See eagles-db/docs/eagles-db/licensing-hiring-unit.md.
|
|
2927
|
-
model LicensingLedgerEntry {
|
|
2928
|
-
id String @id @default(uuid())
|
|
2929
|
-
organisation_id String
|
|
2930
|
-
/// Null for org-level rows (e.g. unallocated top-ups later).
|
|
2931
|
-
purchased_hiring_unit_id String?
|
|
2932
|
-
entitlement_type LicensingLedgerEntitlementType
|
|
2933
|
-
direction LicensingLedgerDirection
|
|
2934
|
-
/// Always non-negative. CREDIT of 0 means the stem is included at zero.
|
|
2935
|
-
amount Decimal @db.Decimal(20, 4)
|
|
2936
|
-
reason LicensingLedgerReason
|
|
2937
|
-
occurred_at DateTime @default(now())
|
|
2938
|
-
source_type String?
|
|
2939
|
-
source_id String?
|
|
2940
|
-
description String?
|
|
2941
|
-
idempotency_key String @unique
|
|
2942
|
-
created_at DateTime @default(now())
|
|
2943
|
-
updated_at DateTime @default(now()) @updatedAt
|
|
2944
|
-
created_by String
|
|
2945
|
-
updated_by String
|
|
2946
|
-
is_active Boolean @default(true)
|
|
2947
|
-
|
|
2948
|
-
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2949
|
-
purchased_hiring_unit PurchasedHiringUnit? @relation(fields: [purchased_hiring_unit_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2950
|
-
|
|
2951
|
-
@@index([purchased_hiring_unit_id, entitlement_type, occurred_at], map: "licensing_ledger_unit_type_occurred_idx")
|
|
2952
|
-
@@index([organisation_id, entitlement_type, occurred_at], map: "licensing_ledger_org_type_occurred_idx")
|
|
2953
|
-
@@map("licensing_ledger")
|
|
2954
|
-
@@schema("licensing")
|
|
2955
|
-
}
|
|
2956
|
-
|
|
2957
|
-
/// Historical package purchase by an organisation (independent per transaction).
|
|
2958
|
-
model PurchasedLicensePackage {
|
|
2959
|
-
id String @id @default(uuid())
|
|
2960
|
-
organisation_id String
|
|
2961
|
-
license_package_id String
|
|
2962
|
-
/// Snapshot of catalogue identity at purchase time.
|
|
2963
|
-
package_code String
|
|
2964
|
-
package_version Int
|
|
2965
|
-
package_name String
|
|
2966
|
-
price Decimal @db.Decimal(18, 2)
|
|
2967
|
-
currency String @default("INR")
|
|
2968
|
-
units_per_purchase Int
|
|
2969
|
-
/// How many package instances were bought in this transaction.
|
|
2970
|
-
package_quantity Int @default(1)
|
|
2971
|
-
purchased_at DateTime @default(now())
|
|
2972
|
-
status PurchasedLicensePackageStatus @default(ACTIVE)
|
|
2973
|
-
created_at DateTime @default(now())
|
|
2974
|
-
updated_at DateTime @updatedAt
|
|
2975
|
-
created_by String
|
|
2976
|
-
updated_by String
|
|
2977
|
-
is_active Boolean @default(true)
|
|
2978
|
-
|
|
2979
|
-
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2980
|
-
license_package LicensePackage @relation(fields: [license_package_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
2981
|
-
hiring_units PurchasedHiringUnit[]
|
|
2982
|
-
|
|
2983
|
-
@@index([organisation_id])
|
|
2984
|
-
@@index([organisation_id, status])
|
|
2985
|
-
@@index([organisation_id, purchased_at])
|
|
2986
|
-
@@map("purchased_license_packages")
|
|
2987
|
-
@@schema("licensing")
|
|
2988
|
-
}
|
|
2989
|
-
|
|
2990
|
-
/// Runtime hiring unit identity and allocation. Entitlement balances live on
|
|
2991
|
-
/// `licensing.licensing_ledger` (Prisma model `LicensingLedgerEntry`).
|
|
2992
|
-
/// See eagles-db/docs/eagles-db/licensing-hiring-unit.md.
|
|
2993
|
-
model PurchasedHiringUnit {
|
|
2994
|
-
id String @id @default(uuid())
|
|
2995
|
-
organisation_id String
|
|
2996
|
-
purchased_license_package_id String
|
|
2997
|
-
status PurchasedHiringUnitStatus @default(AVAILABLE)
|
|
2998
|
-
/// Current department allocation (licensing allocation, not hiring manager).
|
|
2999
|
-
department_id String?
|
|
3000
|
-
/// Set once when department_id is first assigned; not cleared on reassignment.
|
|
3001
|
-
first_assigned_at DateTime?
|
|
3002
|
-
/// Optional unit expiry.
|
|
3003
|
-
expiry_at DateTime?
|
|
3004
|
-
/// Optional job association (distinct from JobDescription.hiring_manager_id).
|
|
3005
|
-
job_description_id String?
|
|
3006
|
-
|
|
3007
|
-
created_at DateTime @default(now())
|
|
3008
|
-
updated_at DateTime @updatedAt
|
|
3009
|
-
created_by String
|
|
3010
|
-
updated_by String
|
|
3011
|
-
is_active Boolean @default(true)
|
|
3012
|
-
|
|
3013
|
-
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3014
|
-
purchased_license_package PurchasedLicensePackage @relation(fields: [purchased_license_package_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3015
|
-
department Department? @relation(fields: [department_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
3016
|
-
job_description JobDescription? @relation(fields: [job_description_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
3017
|
-
assignment_events PurchasedHiringUnitAssignmentEvent[]
|
|
3018
|
-
ledger_entries LicensingLedgerEntry[]
|
|
3019
|
-
ai_cost_ledger_entries AiCostLedgerEntry[]
|
|
3020
|
-
|
|
3021
|
-
@@index([organisation_id])
|
|
3022
|
-
@@index([purchased_license_package_id])
|
|
3023
|
-
@@index([department_id])
|
|
3024
|
-
@@index([job_description_id])
|
|
3025
|
-
@@index([organisation_id, status])
|
|
3026
|
-
@@index([organisation_id, department_id])
|
|
3027
|
-
@@index([organisation_id, job_description_id])
|
|
3028
|
-
@@map("purchased_hiring_units")
|
|
3029
|
-
@@schema("licensing")
|
|
3030
|
-
}
|
|
3031
|
-
|
|
3032
|
-
/// Wide top-up purchase: org-level per-metric pool (purchased / remaining) before allocation to hiring units.
|
|
3033
|
-
model PurchasedTopUp {
|
|
3034
|
-
id String @id @default(uuid())
|
|
3035
|
-
organisation_id String
|
|
3036
|
-
purchased_at DateTime @default(now())
|
|
3037
|
-
status PurchasedTopUpStatus @default(ACTIVE)
|
|
3038
|
-
total_price Decimal? @db.Decimal(18, 2)
|
|
3039
|
-
currency String? @default("INR")
|
|
3040
|
-
description String?
|
|
3041
|
-
|
|
3042
|
-
interview_ai_assisted_hours_purchased Decimal? @db.Decimal(20, 4)
|
|
3043
|
-
interview_full_ai_hours_purchased Decimal? @db.Decimal(20, 4)
|
|
3044
|
-
interview_non_ai_hours_purchased Decimal? @db.Decimal(20, 4)
|
|
3045
|
-
assignment_count_purchased Decimal? @db.Decimal(20, 4)
|
|
3046
|
-
test_count_purchased Decimal? @db.Decimal(20, 4)
|
|
3047
|
-
resume_count_purchased Decimal? @db.Decimal(20, 4)
|
|
3048
|
-
credits_purchased Decimal? @db.Decimal(20, 4)
|
|
3049
|
-
|
|
3050
|
-
interview_ai_assisted_hours_remaining Decimal? @db.Decimal(20, 4)
|
|
3051
|
-
interview_full_ai_hours_remaining Decimal? @db.Decimal(20, 4)
|
|
3052
|
-
interview_non_ai_hours_remaining Decimal? @db.Decimal(20, 4)
|
|
3053
|
-
assignment_count_remaining Decimal? @db.Decimal(20, 4)
|
|
3054
|
-
test_count_remaining Decimal? @db.Decimal(20, 4)
|
|
3055
|
-
resume_count_remaining Decimal? @db.Decimal(20, 4)
|
|
3056
|
-
credits_remaining Decimal? @db.Decimal(20, 4)
|
|
3057
|
-
|
|
3058
|
-
created_at DateTime @default(now())
|
|
3059
|
-
updated_at DateTime @updatedAt
|
|
3060
|
-
created_by String
|
|
3061
|
-
updated_by String
|
|
3062
|
-
is_active Boolean @default(true)
|
|
3063
|
-
|
|
3064
|
-
organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
|
|
3065
|
-
|
|
3066
|
-
@@index([organisation_id])
|
|
3067
|
-
@@index([organisation_id, status])
|
|
3068
|
-
@@map("purchased_top_ups")
|
|
3069
|
-
@@schema("licensing")
|
|
3070
|
-
}
|
|
3071
|
-
|
|
3072
2733
|
model LiveAnalysis {
|
|
3073
2734
|
id String @id @default(uuid())
|
|
3074
2735
|
//foreign keys
|
|
@@ -3491,71 +3152,65 @@ enum OrganisationSize {
|
|
|
3491
3152
|
}
|
|
3492
3153
|
|
|
3493
3154
|
model Organisation {
|
|
3494
|
-
id
|
|
3495
|
-
name
|
|
3496
|
-
industry
|
|
3497
|
-
about
|
|
3498
|
-
website
|
|
3499
|
-
size
|
|
3500
|
-
phone
|
|
3501
|
-
address
|
|
3502
|
-
company_values
|
|
3503
|
-
allowed_email_domains
|
|
3504
|
-
send_email
|
|
3505
|
-
interviewers
|
|
3506
|
-
created_at
|
|
3507
|
-
updated_at
|
|
3508
|
-
created_by
|
|
3509
|
-
updated_by
|
|
3510
|
-
is_active
|
|
3511
|
-
alias
|
|
3512
|
-
logo
|
|
3513
|
-
job_sequence
|
|
3514
|
-
employee_sequence
|
|
3515
|
-
applications
|
|
3516
|
-
user_roles
|
|
3517
|
-
job_descriptions
|
|
3518
|
-
job_profiles
|
|
3519
|
-
assessment_library
|
|
3520
|
-
assignment_library
|
|
3521
|
-
interviews
|
|
3522
|
-
assignments
|
|
3523
|
-
fit_check
|
|
3524
|
-
resumes
|
|
3525
|
-
approvals
|
|
3526
|
-
suggestions
|
|
3527
|
-
ongoing_evaluations
|
|
3528
|
-
actions
|
|
3529
|
-
integration_credentials
|
|
3530
|
-
zoho_sync_mappings
|
|
3531
|
-
assessments
|
|
3532
|
-
timezone
|
|
3155
|
+
id String @id @default(uuid())
|
|
3156
|
+
name String @unique
|
|
3157
|
+
industry String
|
|
3158
|
+
about String
|
|
3159
|
+
website String
|
|
3160
|
+
size OrganisationSize @default(ONE_TO_TEN)
|
|
3161
|
+
phone String
|
|
3162
|
+
address String
|
|
3163
|
+
company_values Json[]
|
|
3164
|
+
allowed_email_domains String[]
|
|
3165
|
+
send_email Boolean @default(true)
|
|
3166
|
+
interviewers User[]
|
|
3167
|
+
created_at DateTime @default(now())
|
|
3168
|
+
updated_at DateTime @updatedAt
|
|
3169
|
+
created_by String
|
|
3170
|
+
updated_by String
|
|
3171
|
+
is_active Boolean @default(true)
|
|
3172
|
+
alias String? @unique
|
|
3173
|
+
logo String?
|
|
3174
|
+
job_sequence Int @default(1)
|
|
3175
|
+
employee_sequence Int @default(1)
|
|
3176
|
+
applications Application[]
|
|
3177
|
+
user_roles UserRole[]
|
|
3178
|
+
job_descriptions JobDescription[]
|
|
3179
|
+
job_profiles JobProfile[]
|
|
3180
|
+
assessment_library AssessmentLibrary[]
|
|
3181
|
+
assignment_library AssignmentLibrary[]
|
|
3182
|
+
interviews Interview[]
|
|
3183
|
+
assignments Assignment[]
|
|
3184
|
+
fit_check FitCheck[] // one-to-many link
|
|
3185
|
+
resumes Resume[] // one-to-many link
|
|
3186
|
+
approvals Approval[] // one-to-many link
|
|
3187
|
+
suggestions Suggestion[]
|
|
3188
|
+
ongoing_evaluations OngoingEvaluation[] // optional one-to-many
|
|
3189
|
+
actions Action[]
|
|
3190
|
+
integration_credentials IntegrationCredential[]
|
|
3191
|
+
zoho_sync_mappings ZohoSyncMapping[]
|
|
3192
|
+
assessments Assessment[]
|
|
3193
|
+
timezone String @default("Asia/Kolkata")
|
|
3533
3194
|
/// ISO 3166-1 alpha-2 (e.g. IN).
|
|
3534
|
-
country_code
|
|
3535
|
-
organisation_configs
|
|
3536
|
-
activity_events
|
|
3537
|
-
usage_ledger_entries
|
|
3538
|
-
usage_aggregates
|
|
3539
|
-
channel_provider_configs
|
|
3540
|
-
conversations
|
|
3541
|
-
communication_messages
|
|
3542
|
-
job_application_fields
|
|
3543
|
-
documents
|
|
3544
|
-
job_application_templates
|
|
3545
|
-
offer_letter_templates
|
|
3546
|
-
offers
|
|
3547
|
-
sources
|
|
3548
|
-
evaluation_criteria
|
|
3549
|
-
departments
|
|
3550
|
-
hiring_plans
|
|
3551
|
-
employees
|
|
3552
|
-
competency_dictionaries
|
|
3553
|
-
purchased_license_packages PurchasedLicensePackage[]
|
|
3554
|
-
purchased_hiring_units PurchasedHiringUnit[]
|
|
3555
|
-
purchased_top_ups PurchasedTopUp[]
|
|
3556
|
-
licensing_ledger_entries LicensingLedgerEntry[]
|
|
3557
|
-
license_package_organisations LicensePackageOrganisation[]
|
|
3558
|
-
ai_cost_ledger_entries AiCostLedgerEntry[]
|
|
3195
|
+
country_code String @default("IN")
|
|
3196
|
+
organisation_configs OrganisationConfig[]
|
|
3197
|
+
activity_events ActivityEvent[]
|
|
3198
|
+
usage_ledger_entries UsageLedgerEntry[]
|
|
3199
|
+
usage_aggregates UsageAggregate[]
|
|
3200
|
+
channel_provider_configs ChannelProviderConfig[]
|
|
3201
|
+
conversations Conversation[]
|
|
3202
|
+
communication_messages CommunicationMessage[]
|
|
3203
|
+
job_application_fields JobApplicationField[]
|
|
3204
|
+
documents Document[]
|
|
3205
|
+
job_application_templates JobApplicationTemplate[]
|
|
3206
|
+
offer_letter_templates OfferLetterTemplate[]
|
|
3207
|
+
offers Offer[]
|
|
3208
|
+
sources Source[]
|
|
3209
|
+
evaluation_criteria EvaluationCriteria[]
|
|
3210
|
+
departments Department[]
|
|
3211
|
+
hiring_plans HiringPlan[]
|
|
3212
|
+
employees Employee[]
|
|
3213
|
+
competency_dictionaries CompetencyDictionary[]
|
|
3559
3214
|
|
|
3560
3215
|
@@index([name])
|
|
3561
3216
|
@@schema("public")
|
|
@@ -4020,7 +3675,7 @@ datasource db {
|
|
|
4020
3675
|
provider = "postgresql"
|
|
4021
3676
|
url = env("DATABASE_URL")
|
|
4022
3677
|
|
|
4023
|
-
schemas = ["public", "analytics", "usage"
|
|
3678
|
+
schemas = ["public", "analytics", "usage"]
|
|
4024
3679
|
}
|
|
4025
3680
|
|
|
4026
3681
|
enum SourceCategory {
|
|
@@ -4379,6 +4034,8 @@ model User {
|
|
|
4379
4034
|
|
|
4380
4035
|
name String?
|
|
4381
4036
|
phone String?
|
|
4037
|
+
/// Contact email for interviews, assessments, and resume export. Login stays on `email`.
|
|
4038
|
+
communication_email String?
|
|
4382
4039
|
description String?
|
|
4383
4040
|
date_of_birth DateTime?
|
|
4384
4041
|
designation String?
|