@valentine-efagene/qshelter-common 2.0.54 → 2.0.55

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.
@@ -23,7 +23,6 @@ export * from './PaymentMethodPhaseDocument';
23
23
  export * from './PaymentMethodPhaseStep';
24
24
  export * from './PaymentPlan';
25
25
  export * from './Permission';
26
- export * from './Prequalification';
27
26
  export * from './Property';
28
27
  export * from './PropertyAmenity';
29
28
  export * from './PropertyDocument';
@@ -42,7 +41,6 @@ export * from './Settings';
42
41
  export * from './Social';
43
42
  export * from './Tenant';
44
43
  export * from './Transaction';
45
- export * from './UnderwritingDecision';
46
44
  export * from './User';
47
45
  export * from './UserRole';
48
46
  export * from './UserSuspension';
@@ -23,7 +23,6 @@ export * from './PaymentMethodPhaseDocument';
23
23
  export * from './PaymentMethodPhaseStep';
24
24
  export * from './PaymentPlan';
25
25
  export * from './Permission';
26
- export * from './Prequalification';
27
26
  export * from './Property';
28
27
  export * from './PropertyAmenity';
29
28
  export * from './PropertyDocument';
@@ -42,7 +41,6 @@ export * from './Settings';
42
41
  export * from './Social';
43
42
  export * from './Tenant';
44
43
  export * from './Transaction';
45
- export * from './UnderwritingDecision';
46
44
  export * from './User';
47
45
  export * from './UserRole';
48
46
  export * from './UserSuspension';
@@ -42,8 +42,6 @@ export type * from './models/ContractEvent.js';
42
42
  export type * from './models/DocumentTemplate.js';
43
43
  export type * from './models/OfferLetter.js';
44
44
  export type * from './models/ContractTermination.js';
45
- export type * from './models/Prequalification.js';
46
- export type * from './models/UnderwritingDecision.js';
47
45
  export type * from './models/PaymentMethodChangeRequest.js';
48
46
  export type * from './models/DocumentRequirementRule.js';
49
47
  export type * from './models/DomainEvent.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valentine-efagene/qshelter-common",
3
- "version": "2.0.54",
3
+ "version": "2.0.55",
4
4
  "description": "Shared database schemas and utilities for QShelter services",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -182,12 +182,6 @@ enum OfferLetterStatus {
182
182
  CANCELLED
183
183
  }
184
184
 
185
- enum UnderwritingDecisionKind {
186
- APPROVE
187
- REJECT
188
- CONDITIONAL
189
- }
190
-
191
185
  // =============================================================================
192
186
  // USER & AUTH DOMAIN
193
187
  // =============================================================================
@@ -232,8 +226,7 @@ model User {
232
226
  stepApprovals DocumentationStepApproval[] @relation("DocumentationStepApprover")
233
227
  uploadedDocs ContractDocument[] @relation("DocumentUploader")
234
228
 
235
- // Prequalification and payment method changes
236
- prequalifications Prequalification[]
229
+ // Payment method changes
237
230
  paymentMethodChangeRequests PaymentMethodChangeRequest[] @relation("ChangeRequestor")
238
231
  reviewedChangeRequests PaymentMethodChangeRequest[] @relation("ChangeReviewer")
239
232
 
@@ -314,8 +307,7 @@ model Tenant {
314
307
  paymentMethods PropertyPaymentMethod[]
315
308
  contracts Contract[]
316
309
 
317
- // Prequalification and payment method changes
318
- prequalifications Prequalification[]
310
+ // Payment method changes
319
311
  paymentMethodChangeRequests PaymentMethodChangeRequest[]
320
312
  documentRequirementRules DocumentRequirementRule[]
321
313
 
@@ -326,9 +318,6 @@ model Tenant {
326
318
  documentTemplates DocumentTemplate[]
327
319
  offerLetters OfferLetter[]
328
320
 
329
- // Underwriting
330
- underwritingDecisions UnderwritingDecision[]
331
-
332
321
  @@index([subdomain])
333
322
  @@map("tenants")
334
323
  }
@@ -504,12 +493,11 @@ model Property {
504
493
  updatedAt DateTime @updatedAt
505
494
 
506
495
  // Relations
507
- documents PropertyDocument[]
508
- media PropertyMedia[] @relation("PropertyMedia")
509
- amenities PropertyAmenity[] // Shared amenities (gym, pool, security)
510
- paymentMethods PropertyPaymentMethodLink[]
511
- variants PropertyVariant[]
512
- prequalifications Prequalification[]
496
+ documents PropertyDocument[]
497
+ media PropertyMedia[] @relation("PropertyMedia")
498
+ amenities PropertyAmenity[] // Shared amenities (gym, pool, security)
499
+ paymentMethods PropertyPaymentMethodLink[]
500
+ variants PropertyVariant[]
513
501
 
514
502
  @@index([tenantId])
515
503
  @@index([userId])
@@ -759,9 +747,6 @@ model PropertyPaymentMethod {
759
747
  // Contracts using this method
760
748
  contracts Contract[]
761
749
 
762
- // Prequalifications for this payment method
763
- prequalifications Prequalification[]
764
-
765
750
  // Payment method change tracking
766
751
  changeRequestsFrom PaymentMethodChangeRequest[] @relation("ChangeFromMethod")
767
752
  changeRequestsTo PaymentMethodChangeRequest[] @relation("ChangeToMethod")
@@ -947,8 +932,6 @@ model Contract {
947
932
  terminations ContractTermination[]
948
933
  offerLetters OfferLetter[]
949
934
 
950
- // Prequalification that led to this contract (optional)
951
- prequalification Prequalification?
952
935
  // Payment method change requests for this contract
953
936
  paymentMethodChangeRequests PaymentMethodChangeRequest[]
954
937
 
@@ -1418,119 +1401,7 @@ model ContractTermination {
1418
1401
  @@map("contract_terminations")
1419
1402
  }
1420
1403
 
1421
- // =============================================================================
1422
- // PREQUALIFICATION - Eligibility assessment before contract creation
1423
- // =============================================================================
1424
- // Prequalification is a separate aggregate that evaluates a user's eligibility
1425
- // for a specific product (property + payment method). It captures their answers
1426
- // to eligibility questions and calculates a score. Once approved, it can be
1427
- // linked to a Contract to provide context about how the buyer qualified.
1428
- // =============================================================================
1429
1404
 
1430
- enum PrequalificationStatus {
1431
- DRAFT
1432
- SUBMITTED
1433
- UNDER_REVIEW
1434
- APPROVED
1435
- REJECTED
1436
- EXPIRED
1437
- }
1438
-
1439
- model Prequalification {
1440
- id String @id @default(cuid())
1441
- tenantId String
1442
- tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
1443
- userId String
1444
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
1445
-
1446
- // What they're applying for
1447
- propertyId String
1448
- property Property @relation(fields: [propertyId], references: [id], onDelete: Cascade)
1449
- paymentMethodId String
1450
- paymentMethod PropertyPaymentMethod @relation(fields: [paymentMethodId], references: [id])
1451
-
1452
- // Questionnaire responses and scoring
1453
- answers Json // Array of {questionId, answer, weight, score}
1454
- score Float? // Computed eligibility score (0-100)
1455
-
1456
- // Financial assessment
1457
- requestedAmount Float? // How much they want to finance
1458
- monthlyIncome Float? // Self-reported monthly income
1459
- monthlyExpenses Float? // Self-reported monthly expenses
1460
- debtToIncomeRatio Float? // Computed DTI
1461
- suggestedTermMonths Int? // System-suggested term based on affordability
1462
-
1463
- // Status tracking
1464
- status PrequalificationStatus @default(DRAFT)
1465
- notes String? @db.Text // Admin notes
1466
- reviewedBy String? // Admin who reviewed
1467
- reviewedAt DateTime?
1468
- expiresAt DateTime? // Prequalification validity period
1469
-
1470
- // If approved, may be linked to eventual contract
1471
- contractId String? @unique
1472
- contract Contract? @relation(fields: [contractId], references: [id])
1473
-
1474
- // Underwriting decisions for this prequalification
1475
- underwritingDecisions UnderwritingDecision[]
1476
-
1477
- createdAt DateTime @default(now())
1478
- updatedAt DateTime @updatedAt
1479
-
1480
- @@index([tenantId])
1481
- @@index([userId])
1482
- @@index([propertyId])
1483
- @@index([status])
1484
- @@map("prequalifications")
1485
- }
1486
-
1487
- // =============================================================================
1488
- // UNDERWRITING DECISION - Automated/manual credit decisions
1489
- // =============================================================================
1490
- // Records each underwriting decision for a prequalification. Multiple decisions
1491
- // may exist if re-evaluation occurs (e.g., after document submission).
1492
- // =============================================================================
1493
-
1494
- model UnderwritingDecision {
1495
- id String @id @default(cuid())
1496
- tenantId String
1497
- tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
1498
-
1499
- // Link to prequalification being evaluated
1500
- prequalificationId String
1501
- prequalification Prequalification @relation(fields: [prequalificationId], references: [id], onDelete: Cascade)
1502
-
1503
- // Decision outcome
1504
- decision UnderwritingDecisionKind
1505
-
1506
- // Scoring and rationale
1507
- score Float? // Computed risk score (0-100)
1508
- reasons Json? // Array of reason codes/messages for decision
1509
- conditions Json? // Array of conditions for CONDITIONAL decisions
1510
-
1511
- // Rule engine metadata
1512
- rulesVersion String? // Version of rules/model used
1513
- ruleResults Json? // Detailed rule evaluation results
1514
-
1515
- // External data references (credit bureau, verifications)
1516
- externalChecks Json? // { creditBureau: {...}, incomeVerification: {...} }
1517
-
1518
- // Manual review (if escalated)
1519
- isManualReview Boolean @default(false)
1520
- reviewedBy String? // Admin who reviewed
1521
- reviewedAt DateTime?
1522
- reviewNotes String? @db.Text
1523
-
1524
- // Audit
1525
- createdAt DateTime @default(now())
1526
- updatedAt DateTime @updatedAt
1527
-
1528
- @@index([tenantId])
1529
- @@index([prequalificationId])
1530
- @@index([decision])
1531
- @@index([createdAt])
1532
- @@map("underwriting_decisions")
1533
- }
1534
1405
 
1535
1406
  // =============================================================================
1536
1407
  // PAYMENT METHOD CHANGE REQUEST - Mid-contract payment method changes
@@ -1613,7 +1484,6 @@ model PaymentMethodChangeRequest {
1613
1484
  // =============================================================================
1614
1485
 
1615
1486
  enum DocumentRequirementContext {
1616
- PREQUALIFICATION // During prequalification
1617
1487
  CONTRACT_PHASE // During a contract phase
1618
1488
  PAYMENT_METHOD_CHANGE // When changing payment method mid-contract
1619
1489
  }