@valentine-efagene/qshelter-common 2.0.145 → 2.0.147

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.
@@ -367,6 +367,7 @@ enum ApplicationEventType {
367
367
  APPLICATION_TRANSFERRED
368
368
  UNDERWRITING_COMPLETED
369
369
  OFFER_LETTER_GENERATED
370
+ HANDLER_EXECUTED // Event handler was executed
370
371
  }
371
372
 
372
373
  enum ApplicationEventGroup {
@@ -375,6 +376,7 @@ enum ApplicationEventGroup {
375
376
  DOCUMENT
376
377
  NOTIFICATION
377
378
  WORKFLOW
379
+ AUTOMATION // Automated handler executions
378
380
  }
379
381
 
380
382
  enum EventActorType {
@@ -1304,6 +1306,9 @@ model PropertyUnit {
1304
1306
  // Ownership tracking (once sold)
1305
1307
  ownerId String?
1306
1308
 
1309
+ // Optimistic locking for unit reservation race condition
1310
+ version Int @default(0)
1311
+
1307
1312
  createdAt DateTime @default(now())
1308
1313
  updatedAt DateTime @updatedAt
1309
1314
 
@@ -1719,6 +1724,7 @@ model PropertyPaymentMethodPhase {
1719
1724
  // Application phases created from this template
1720
1725
  applicationPhases ApplicationPhase[]
1721
1726
 
1727
+ @@unique([paymentMethodId, order]) // Enforce unique, sequential ordering
1722
1728
  @@index([tenantId])
1723
1729
  @@index([paymentMethodId])
1724
1730
  @@index([paymentPlanId])
@@ -1779,6 +1785,7 @@ model PaymentMethodPhaseStep {
1779
1785
  // Event attachments - handlers that fire on step transitions
1780
1786
  eventAttachments StepEventAttachment[]
1781
1787
 
1788
+ @@unique([phaseId, order]) // Enforce unique, sequential ordering within phase
1782
1789
  @@index([tenantId])
1783
1790
  @@index([phaseId])
1784
1791
  @@map("payment_method_phase_steps")
@@ -1969,7 +1976,7 @@ model Application {
1969
1976
  tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
1970
1977
  // Link to specific unit being purchased/rented
1971
1978
  propertyUnitId String
1972
- propertyUnit PropertyUnit @relation(fields: [propertyUnitId], references: [id], onDelete: Cascade)
1979
+ propertyUnit PropertyUnit @relation(fields: [propertyUnitId], references: [id], onDelete: Restrict)
1973
1980
  buyerId String
1974
1981
  buyer User @relation("ApplicationBuyer", fields: [buyerId], references: [id], onDelete: Cascade)
1975
1982
  sellerId String?
@@ -2451,6 +2458,9 @@ model PaymentPhase {
2451
2458
  // Snapshot for audit
2452
2459
  paymentPlanSnapshot Json?
2453
2460
 
2461
+ // Optimistic locking for concurrent payment protection
2462
+ version Int @default(0)
2463
+
2454
2464
  createdAt DateTime @default(now())
2455
2465
  updatedAt DateTime @updatedAt
2456
2466
 
@@ -2583,6 +2593,9 @@ model PaymentInstallment {
2583
2593
  gracePeriodDays Int @default(0)
2584
2594
  gracePeriodEndDate DateTime?
2585
2595
 
2596
+ // Optimistic locking for concurrent payment protection
2597
+ version Int @default(0)
2598
+
2586
2599
  createdAt DateTime @default(now())
2587
2600
  updatedAt DateTime @updatedAt
2588
2601