@adaptware/eagles-db 0.6.17 → 0.6.20

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "prisma-client-f0391a01c267ab1f703c4b9658aa0d675b0ffaa064f1069e1a145d0508245379",
2
+ "name": "prisma-client-f9dfd42959517f82e3b36fae4c5581f4a719fe74ada0cbbbee19a80532ba05ec",
3
3
  "main": "index.js",
4
4
  "types": "index.d.ts",
5
5
  "browser": "default.js",
@@ -1252,9 +1252,11 @@ model CompetencyDictionary {
1252
1252
 
1253
1253
  enum ConsentType {
1254
1254
  PLATFORM_TERMS
1255
+ /// Retained until the next production push. Catalog rows move to EVALUATION_CONSENT.
1255
1256
  INTERVIEW_SESSION
1256
- /// Read-only catalog document; no ConsentRecord submit flow
1257
+ /// Read-only catalog document; no ConsentRecord submit flow. Retained until the next production push.
1257
1258
  PRIVACY_POLICY
1259
+ EVALUATION_CONSENT
1258
1260
 
1259
1261
  @@schema("public")
1260
1262
  }
@@ -1393,7 +1395,9 @@ model ConsentRecord {
1393
1395
  // Dual-existence for non-breaking migration
1394
1396
  reference_type ConsentReferenceType?
1395
1397
  reference_id String?
1398
+ /// OngoingEvaluation.id. Reference columns stay until the next production push.
1396
1399
  evaluation_id String?
1400
+ evaluation OngoingEvaluation? @relation(fields: [evaluation_id], references: [id], onDelete: SetNull)
1397
1401
 
1398
1402
  ip_address String?
1399
1403
  user_agent String?
@@ -1647,6 +1651,10 @@ enum EvaluationCategory {
1647
1651
  BUSINESS_SCREENING
1648
1652
  BUSINESS_ROUND
1649
1653
  BEHAVIORAL_ROUND
1654
+ FILTERING
1655
+ EVALUATION
1656
+ DECISION
1657
+ OFFER
1650
1658
 
1651
1659
  @@schema("public")
1652
1660
  }
@@ -2229,7 +2237,6 @@ model Interview {
2229
2237
  /// Candidate invite response (legal consent in ConsentRecord).
2230
2238
  candidate_status String? @default("INVITED")
2231
2239
  candidate_responded_at DateTime?
2232
- decline_reason String?
2233
2240
  /// When this timestamp moves forward, prior INTERVIEW_SESSION consent grants are stale.
2234
2241
  consent_epoch_at DateTime @default(now())
2235
2242
 
@@ -3183,212 +3190,6 @@ model LicensingLedgerEntry {
3183
3190
  @@schema("licensing")
3184
3191
  }
3185
3192
 
3186
- // Org-level platform subscription: a recurring fee per organisation. Each period is a SubscriptionCharge, paid through
3187
- // a Razorpay Order (BillingTransaction with transaction_type SUBSCRIPTION); the tax Invoice (kind SUBSCRIPTION) is issued
3188
- // only once the charge is paid. Prices are all-inclusive (GST and fees are backed out on the invoice). Amounts are minor units.
3189
- // Plan: docs/eagles-db/platform-subscription-implementation-plan.md.
3190
- // Design sheet: https://docs.google.com/spreadsheets/d/1R-EBGAMdju_P78Qs05g4_NouSbCM_7W-IyCd8gyZCUI (Sheet2).
3191
-
3192
- enum BillingCycle {
3193
- MONTHLY
3194
- ANNUAL
3195
-
3196
- @@schema("licensing")
3197
- }
3198
-
3199
- enum SubscriptionPlanType {
3200
- TRIAL
3201
- REGULAR
3202
- /// Internal and demo orgs: amount 0, never charged, never PAST_DUE or SUSPENDED.
3203
- INTERNAL
3204
-
3205
- @@schema("licensing")
3206
- }
3207
-
3208
- enum PlatformSubscriptionStatus {
3209
- TRIALING
3210
- ACTIVE
3211
- /// Grace: charge OPEN until due_at; everyone in the org keeps full access.
3212
- PAST_DUE
3213
- /// After due_at (or a trial ending unpaid): only org admins can log in, payment screen only.
3214
- SUSPENDED
3215
- CANCELLED
3216
-
3217
- @@schema("licensing")
3218
- }
3219
-
3220
- enum SubscriptionChargeStatus {
3221
- OPEN
3222
- PAID
3223
- VOID
3224
-
3225
- @@schema("licensing")
3226
- }
3227
-
3228
- /// Tells the payment-captured handler what to do: RENEWAL keeps the current record;
3229
- /// CONVERSION, REACTIVATION and UPGRADE close it and start a new one on the payment day.
3230
- enum SubscriptionChargeKind {
3231
- RENEWAL
3232
- CONVERSION
3233
- REACTIVATION
3234
- UPGRADE
3235
-
3236
- @@schema("licensing")
3237
- }
3238
-
3239
- enum SubscriptionAccessAudience {
3240
- /// Anyone in the suspended org (e.g. candidate-facing flows).
3241
- ALL_USERS
3242
- /// Org admins only (e.g. the payment screen).
3243
- ADMIN_ONLY
3244
-
3245
- @@schema("licensing")
3246
- }
3247
-
3248
- /// Platform fee catalogue, one row per (currency, billing_cycle, type).
3249
- /// A TRIAL plan has amount 0; trial_days sets the default trial length.
3250
- /// An INTERNAL plan has amount 0 and is never billed (internal and demo orgs, assigned by org id).
3251
- /// GST and fee rates come from the platform billing settings, not the plan.
3252
- model SubscriptionPlan {
3253
- id String @id @default(uuid())
3254
- name String
3255
- /// INR or USD; matched against Organisation.billing_currency.
3256
- currency String @default("INR")
3257
- /// All-inclusive price per billing cycle, minor units (1000000 = Rs 10,000): exactly what the org pays.
3258
- amount Int
3259
- billing_cycle BillingCycle @default(MONTHLY)
3260
- type SubscriptionPlanType
3261
- /// TRIAL plans only: default trial length in days, editable by Super Admin. Null otherwise.
3262
- trial_days Int?
3263
- /// Days to pay after a period starts unpaid.
3264
- grace_days Int @default(7)
3265
- created_at DateTime @default(now())
3266
- updated_at DateTime @updatedAt
3267
- created_by String
3268
- updated_by String
3269
- is_active Boolean @default(true)
3270
-
3271
- subscriptions PlatformSubscription[] @relation("PlatformSubscriptionPlan")
3272
- pending_downgrades PlatformSubscription[] @relation("PlatformSubscriptionNextPlan")
3273
- subscription_charges SubscriptionCharge[]
3274
-
3275
- @@unique([currency, billing_cycle, type])
3276
- @@map("subscription_plans")
3277
- @@schema("licensing")
3278
- }
3279
-
3280
- /// History of an org's subscription: one record per plan/billing-anchor span.
3281
- /// The current record has effective_end_date null and current_organisation_id set; the unique constraint on
3282
- /// current_organisation_id allows at most one current record per org.
3283
- model PlatformSubscription {
3284
- id String @id @default(uuid())
3285
- organisation_id String
3286
- /// Equals organisation_id on the current record, null once the record is closed. Unique: one current record per org.
3287
- current_organisation_id String? @unique
3288
- plan_id String
3289
- /// Pending downgrade, applied at the next billing date (billing date unchanged). Null when none.
3290
- next_plan_id String?
3291
- status PlatformSubscriptionStatus @default(TRIALING)
3292
- /// Org's all-inclusive fee per billing cycle, minor units; copied from the plan, overridable.
3293
- amount Int
3294
- /// Billing anchor: the payment date that started this record (after a trial, after grace, or an
3295
- /// upgrade). Unchanged when a renewal is paid within grace.
3296
- effective_start_date DateTime
3297
- /// Null on the current record; set to the date the next record starts.
3298
- effective_end_date DateTime?
3299
- /// TRIAL records only: start + plan.trial_days when the trial starts; Super Admin can change it
3300
- /// per org. Unpaid at this time: SUSPENDED (no grace after a trial). Null otherwise.
3301
- trial_ends_at DateTime?
3302
- /// Copied from the plan.
3303
- grace_days Int
3304
- created_at DateTime @default(now())
3305
- updated_at DateTime @updatedAt
3306
- created_by String
3307
- updated_by String
3308
- is_active Boolean @default(true)
3309
-
3310
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
3311
- plan SubscriptionPlan @relation("PlatformSubscriptionPlan", fields: [plan_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
3312
- next_plan SubscriptionPlan? @relation("PlatformSubscriptionNextPlan", fields: [next_plan_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
3313
- charges SubscriptionCharge[]
3314
-
3315
- @@index([organisation_id, effective_end_date])
3316
- @@index([status, trial_ends_at])
3317
- @@index([plan_id])
3318
- @@index([next_plan_id])
3319
- @@map("platform_subscriptions")
3320
- @@schema("licensing")
3321
- }
3322
-
3323
- /// What the org owes for one billing period, reactivation or upgrade; paid through one Razorpay Order.
3324
- /// Not a tax invoice: the Invoice (kind SUBSCRIPTION) is issued when the charge is paid and linked via invoice_id.
3325
- /// Total = subscription_amount + grace_amount - credit_amount (all-inclusive, not stored).
3326
- model SubscriptionCharge {
3327
- /// Sent to Razorpay as billing_transactions.purchase_reference (subscription_charge:{id}).
3328
- id String @id @default(uuid())
3329
- subscription_id String
3330
- /// Plan this charge bills for; for an upgrade, the new plan.
3331
- plan_id String
3332
- organisation_id String
3333
- kind SubscriptionChargeKind
3334
- status SubscriptionChargeStatus @default(OPEN)
3335
- period_start DateTime
3336
- period_end DateTime
3337
- /// period_start + grace_days, end of day in the org's timezone. Unpaid after this: SUSPENDED.
3338
- due_at DateTime
3339
- subscription_amount Int
3340
- /// Prorated days used but not paid: grace days when paid after grace, or days from period_start
3341
- /// to the upgrade date when upgrading with an OPEN charge (which is voided).
3342
- grace_amount Int @default(0)
3343
- /// Upgrade only: prorated unused days of the old plan's paid period.
3344
- credit_amount Int @default(0)
3345
- /// Successful payment. No FK: payment-service boundary.
3346
- billing_transaction_id String? @unique
3347
- /// Tax invoice issued when the charge was paid.
3348
- invoice_id String? @unique
3349
- paid_at DateTime?
3350
- /// Stops the billing job issuing the same charge twice.
3351
- idempotency_key String @unique
3352
- created_at DateTime @default(now())
3353
- updated_at DateTime @updatedAt
3354
- created_by String
3355
- updated_by String
3356
-
3357
- subscription PlatformSubscription @relation(fields: [subscription_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
3358
- plan SubscriptionPlan @relation(fields: [plan_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
3359
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
3360
- invoice Invoice? @relation(fields: [invoice_id], references: [id], onDelete: Restrict, onUpdate: Cascade)
3361
-
3362
- @@index([organisation_id, status])
3363
- @@index([subscription_id])
3364
- @@index([plan_id])
3365
- @@index([status, due_at])
3366
- @@map("subscription_charges")
3367
- @@schema("licensing")
3368
- }
3369
-
3370
- /// Routes that stay open while an org is SUSPENDED (access level ADMIN_PAYMENT_ONLY).
3371
- /// Managed by Super Admin; seeded with defaults (auth, payment screen, candidate portal).
3372
- /// Everything not matched is blocked with 402 SUBSCRIPTION_SUSPENDED.
3373
- model SubscriptionAccessRule {
3374
- id String @id @default(uuid())
3375
- /// API path pattern, `*` wildcard, e.g. /candidate/*.
3376
- route_pattern String
3377
- /// GET, POST, ... or * for any method.
3378
- http_method String @default("*")
3379
- audience SubscriptionAccessAudience @default(ADMIN_ONLY)
3380
- description String?
3381
- created_at DateTime @default(now())
3382
- updated_at DateTime @updatedAt
3383
- created_by String
3384
- updated_by String
3385
- is_active Boolean @default(true)
3386
-
3387
- @@unique([route_pattern, http_method])
3388
- @@map("subscription_access_rules")
3389
- @@schema("licensing")
3390
- }
3391
-
3392
3193
  /// Historical package purchase by an organisation (independent per transaction).
3393
3194
  model PurchasedLicensePackage {
3394
3195
  id String @id @default(uuid())
@@ -3895,6 +3696,7 @@ model OngoingEvaluation {
3895
3696
  interview Interview? @relation(fields: [interview_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
3896
3697
  assignment Assignment?
3897
3698
  assessment Assessment? @relation(fields: [assessment_id], references: [id], onDelete: SetNull)
3699
+ consent_records ConsentRecord[]
3898
3700
 
3899
3701
  @@unique([application_id, evaluation_plan_id])
3900
3702
  @@index([application_id])
@@ -4089,8 +3891,6 @@ model Organisation {
4089
3891
  license_package_organisations LicensePackageOrganisation[]
4090
3892
  ai_cost_ledger_entries AiCostLedgerEntry[]
4091
3893
  consent_documents ConsentDocument[]
4092
- platform_subscriptions PlatformSubscription[]
4093
- subscription_charges SubscriptionCharge[]
4094
3894
  billing_transactions BillingTransaction[]
4095
3895
  payment_webhook_events PaymentWebhookEvent[]
4096
3896
  invoices Invoice[]
@@ -4133,7 +3933,6 @@ enum BillingTransactionType {
4133
3933
  PURCHASE
4134
3934
  TOP_UP
4135
3935
  REFUND
4136
- /// Platform subscription charge (purchase_reference subscription_charge:{id}).
4137
3936
  SUBSCRIPTION
4138
3937
 
4139
3938
  @@schema("public")
@@ -4206,12 +4005,11 @@ model BillingTransaction {
4206
4005
  @@schema("public")
4207
4006
  }
4208
4007
 
4209
- // Tax invoices issued by Treadspace. Shared by license package purchases and platform subscriptions.
4008
+ // Tax invoices issued by Treadspace. Shared by license package purchases and (later) platform subscriptions.
4210
4009
 
4211
4010
  /// What the invoice was raised for.
4212
4011
  enum InvoiceKind {
4213
4012
  PACKAGE
4214
- /// A paid platform subscription charge (licensing.subscription_charges.invoice_id).
4215
4013
  SUBSCRIPTION
4216
4014
 
4217
4015
  @@schema("public")
@@ -4259,7 +4057,6 @@ model Invoice {
4259
4057
  organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Restrict)
4260
4058
  billing_transaction BillingTransaction? @relation(fields: [billing_transaction_id], references: [id], onDelete: Restrict)
4261
4059
  purchased_license_package PurchasedLicensePackage?
4262
- subscription_charge SubscriptionCharge?
4263
4060
 
4264
4061
  @@index([organisation_id, issued_at])
4265
4062
  @@map("invoices")