@valentine-efagene/qshelter-common 2.0.93 → 2.0.94

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.
@@ -0,0 +1,11 @@
1
+ -- AlterTable
2
+ ALTER TABLE `payment_phases` ADD COLUMN `numberOfInstallments` INTEGER NULL,
3
+ ADD COLUMN `selectedTermMonths` INTEGER NULL;
4
+
5
+ -- AlterTable
6
+ ALTER TABLE `payment_plans` ADD COLUMN `allowFlexibleTerm` BOOLEAN NOT NULL DEFAULT false,
7
+ ADD COLUMN `maxAgeAtMaturity` INTEGER NULL,
8
+ ADD COLUMN `maxTermMonths` INTEGER NULL,
9
+ ADD COLUMN `minTermMonths` INTEGER NULL,
10
+ ADD COLUMN `termStepMonths` INTEGER NULL,
11
+ MODIFY `numberOfInstallments` INTEGER NULL;
@@ -968,10 +968,20 @@ model PaymentPlan {
968
968
  // Structure configuration
969
969
  paymentFrequency PaymentFrequency
970
970
  customFrequencyDays Int?
971
- numberOfInstallments Int // 1 for one-time, 360 for 30yr monthly, etc
971
+ numberOfInstallments Int? // Fixed number (1 for one-time, 360 for 30yr monthly) - NULL if flexible
972
972
  calculateInterestDaily Boolean @default(false)
973
973
  gracePeriodDays Int @default(0)
974
974
 
975
+ // Flexible term configuration (for user-selectable duration like mortgages)
976
+ // If these are set, numberOfInstallments is ignored and user selects within range
977
+ allowFlexibleTerm Boolean @default(false) // true = user can select term within range
978
+ minTermMonths Int? // e.g., 60 (5 years minimum)
979
+ maxTermMonths Int? // e.g., 360 (30 years maximum)
980
+ termStepMonths Int? // e.g., 12 (increments of 1 year) - NULL = any month allowed
981
+
982
+ // Age-based constraints (for mortgage eligibility)
983
+ maxAgeAtMaturity Int? // e.g., 65 - user's age + term cannot exceed this
984
+
975
985
  // Fund collection behavior
976
986
  // true = we collect funds via wallet/gateway (e.g., downpayment)
977
987
  // false = external payment, we only track/reconcile (e.g., bank mortgage)
@@ -1550,6 +1560,11 @@ model PaymentPhase {
1550
1560
  paidAmount Float @default(0)
1551
1561
  interestRate Float @default(0)
1552
1562
 
1563
+ // User-selected term (for flexible-term plans like mortgages)
1564
+ // These are set when user selects their preferred term at application time
1565
+ selectedTermMonths Int? // User's chosen term (e.g., 240 for 20 years)
1566
+ numberOfInstallments Int? // Calculated from selectedTermMonths and frequency
1567
+
1553
1568
  // Fund collection behavior
1554
1569
  // true = we collect funds via wallet/gateway (e.g., downpayment)
1555
1570
  // false = external payment, we only track/reconcile (e.g., bank mortgage)