@valentine-efagene/qshelter-common 2.0.146 → 2.0.148

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.
@@ -1306,6 +1306,9 @@ model PropertyUnit {
1306
1306
  // Ownership tracking (once sold)
1307
1307
  ownerId String?
1308
1308
 
1309
+ // Optimistic locking for unit reservation race condition
1310
+ version Int @default(0)
1311
+
1309
1312
  createdAt DateTime @default(now())
1310
1313
  updatedAt DateTime @updatedAt
1311
1314
 
@@ -1721,6 +1724,7 @@ model PropertyPaymentMethodPhase {
1721
1724
  // Application phases created from this template
1722
1725
  applicationPhases ApplicationPhase[]
1723
1726
 
1727
+ @@unique([paymentMethodId, order]) // Enforce unique, sequential ordering
1724
1728
  @@index([tenantId])
1725
1729
  @@index([paymentMethodId])
1726
1730
  @@index([paymentPlanId])
@@ -1781,6 +1785,7 @@ model PaymentMethodPhaseStep {
1781
1785
  // Event attachments - handlers that fire on step transitions
1782
1786
  eventAttachments StepEventAttachment[]
1783
1787
 
1788
+ @@unique([phaseId, order]) // Enforce unique, sequential ordering within phase
1784
1789
  @@index([tenantId])
1785
1790
  @@index([phaseId])
1786
1791
  @@map("payment_method_phase_steps")
@@ -1971,7 +1976,7 @@ model Application {
1971
1976
  tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
1972
1977
  // Link to specific unit being purchased/rented
1973
1978
  propertyUnitId String
1974
- propertyUnit PropertyUnit @relation(fields: [propertyUnitId], references: [id], onDelete: Cascade)
1979
+ propertyUnit PropertyUnit @relation(fields: [propertyUnitId], references: [id], onDelete: Restrict)
1975
1980
  buyerId String
1976
1981
  buyer User @relation("ApplicationBuyer", fields: [buyerId], references: [id], onDelete: Cascade)
1977
1982
  sellerId String?
@@ -2453,6 +2458,9 @@ model PaymentPhase {
2453
2458
  // Snapshot for audit
2454
2459
  paymentPlanSnapshot Json?
2455
2460
 
2461
+ // Optimistic locking for concurrent payment protection
2462
+ version Int @default(0)
2463
+
2456
2464
  createdAt DateTime @default(now())
2457
2465
  updatedAt DateTime @updatedAt
2458
2466
 
@@ -2585,6 +2593,9 @@ model PaymentInstallment {
2585
2593
  gracePeriodDays Int @default(0)
2586
2594
  gracePeriodEndDate DateTime?
2587
2595
 
2596
+ // Optimistic locking for concurrent payment protection
2597
+ version Int @default(0)
2598
+
2588
2599
  createdAt DateTime @default(now())
2589
2600
  updatedAt DateTime @updatedAt
2590
2601