@valentine-efagene/qshelter-common 2.0.31 → 2.0.33
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.
- package/dist/generated/client/commonInputTypes.d.ts +22 -0
- package/dist/generated/client/internal/class.js +2 -2
- package/dist/generated/client/internal/prismaNamespace.d.ts +3 -0
- package/dist/generated/client/internal/prismaNamespace.js +3 -0
- package/dist/generated/client/internal/prismaNamespaceBrowser.d.ts +3 -0
- package/dist/generated/client/internal/prismaNamespaceBrowser.js +3 -0
- package/dist/generated/client/models/ContractPhase.d.ts +52 -1
- package/dist/generated/client/models/PaymentPlan.d.ts +42 -1
- package/dist/generated/client/models/PropertyPaymentMethodPhase.d.ts +51 -1
- package/dist/src/config/config.service.d.ts +5 -0
- package/dist/src/config/config.service.js +66 -11
- package/package.json +1 -1
- package/prisma/migrations/20260101110958_add_collect_funds/migration.sql +8 -0
- package/prisma/schema.prisma +84 -69
package/prisma/schema.prisma
CHANGED
|
@@ -104,37 +104,37 @@ enum ApprovalDecision {
|
|
|
104
104
|
// =============================================================================
|
|
105
105
|
|
|
106
106
|
enum TerminationType {
|
|
107
|
-
BUYER_WITHDRAWAL
|
|
108
|
-
SELLER_WITHDRAWAL
|
|
109
|
-
MUTUAL_AGREEMENT
|
|
110
|
-
PAYMENT_DEFAULT
|
|
111
|
-
DOCUMENT_FAILURE
|
|
112
|
-
FRAUD
|
|
113
|
-
FORCE_MAJEURE
|
|
114
|
-
PROPERTY_UNAVAILABLE
|
|
115
|
-
REGULATORY
|
|
116
|
-
OTHER
|
|
107
|
+
BUYER_WITHDRAWAL // Buyer wants to cancel (voluntary)
|
|
108
|
+
SELLER_WITHDRAWAL // Seller/developer cancels
|
|
109
|
+
MUTUAL_AGREEMENT // Both parties agree to terminate
|
|
110
|
+
PAYMENT_DEFAULT // Buyer failed payment obligations
|
|
111
|
+
DOCUMENT_FAILURE // Buyer failed to provide required documents
|
|
112
|
+
FRAUD // Fraudulent activity detected
|
|
113
|
+
FORCE_MAJEURE // External circumstances (disaster, etc.)
|
|
114
|
+
PROPERTY_UNAVAILABLE // Property no longer available
|
|
115
|
+
REGULATORY // Regulatory/legal requirement
|
|
116
|
+
OTHER // Other reasons (with notes)
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
enum TerminationStatus {
|
|
120
|
-
REQUESTED
|
|
121
|
-
PENDING_REVIEW
|
|
122
|
-
PENDING_REFUND
|
|
123
|
-
REFUND_IN_PROGRESS
|
|
124
|
-
REFUND_COMPLETED
|
|
125
|
-
COMPLETED
|
|
126
|
-
REJECTED
|
|
127
|
-
CANCELLED
|
|
120
|
+
REQUESTED // Initial request submitted
|
|
121
|
+
PENDING_REVIEW // Awaiting admin review
|
|
122
|
+
PENDING_REFUND // Approved, awaiting refund processing
|
|
123
|
+
REFUND_IN_PROGRESS // Refund being processed
|
|
124
|
+
REFUND_COMPLETED // Refund completed
|
|
125
|
+
COMPLETED // Termination fully executed (no refund or refund done)
|
|
126
|
+
REJECTED // Termination request rejected
|
|
127
|
+
CANCELLED // Termination request was cancelled
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
enum RefundStatus {
|
|
131
|
-
NOT_APPLICABLE
|
|
132
|
-
PENDING
|
|
133
|
-
INITIATED
|
|
134
|
-
PROCESSING
|
|
135
|
-
PARTIAL_COMPLETED
|
|
136
|
-
COMPLETED
|
|
137
|
-
FAILED
|
|
131
|
+
NOT_APPLICABLE // No refund needed (no payments made)
|
|
132
|
+
PENDING // Refund not yet initiated
|
|
133
|
+
INITIATED // Refund request sent to payment gateway
|
|
134
|
+
PROCESSING // Gateway processing refund
|
|
135
|
+
PARTIAL_COMPLETED // Some refund completed (penalties deducted)
|
|
136
|
+
COMPLETED // Full refund completed
|
|
137
|
+
FAILED // Refund failed (needs manual intervention)
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
enum TerminationInitiator {
|
|
@@ -206,8 +206,8 @@ model User {
|
|
|
206
206
|
reviewedChangeRequests PaymentMethodChangeRequest[] @relation("ChangeReviewer")
|
|
207
207
|
|
|
208
208
|
// Contract terminations
|
|
209
|
-
initiatedTerminations
|
|
210
|
-
reviewedTerminations
|
|
209
|
+
initiatedTerminations ContractTermination[] @relation("TerminationInitiator")
|
|
210
|
+
reviewedTerminations ContractTermination[] @relation("TerminationReviewer")
|
|
211
211
|
|
|
212
212
|
@@index([email])
|
|
213
213
|
@@index([tenantId])
|
|
@@ -284,7 +284,7 @@ model Tenant {
|
|
|
284
284
|
documentRequirementRules DocumentRequirementRule[]
|
|
285
285
|
|
|
286
286
|
// Contract terminations
|
|
287
|
-
contractTerminations
|
|
287
|
+
contractTerminations ContractTermination[]
|
|
288
288
|
|
|
289
289
|
@@index([subdomain])
|
|
290
290
|
@@map("tenants")
|
|
@@ -669,6 +669,11 @@ model PaymentPlan {
|
|
|
669
669
|
calculateInterestDaily Boolean @default(false)
|
|
670
670
|
gracePeriodDays Int @default(0)
|
|
671
671
|
|
|
672
|
+
// Fund collection behavior
|
|
673
|
+
// true = we collect funds via wallet/gateway (e.g., downpayment)
|
|
674
|
+
// false = external payment, we only track/reconcile (e.g., bank mortgage)
|
|
675
|
+
collectFunds Boolean @default(true)
|
|
676
|
+
|
|
672
677
|
createdAt DateTime @default(now())
|
|
673
678
|
updatedAt DateTime @updatedAt
|
|
674
679
|
|
|
@@ -765,6 +770,11 @@ model PropertyPaymentMethodPhase {
|
|
|
765
770
|
interestRate Float?
|
|
766
771
|
percentOfPrice Float? // e.g., 10.0 for 10% downpayment
|
|
767
772
|
|
|
773
|
+
// Fund collection behavior (inherited from PaymentPlan if not set)
|
|
774
|
+
// true = we collect funds via wallet/gateway (e.g., downpayment)
|
|
775
|
+
// false = external payment, we only track/reconcile (e.g., bank mortgage)
|
|
776
|
+
collectFunds Boolean? // null = inherit from PaymentPlan
|
|
777
|
+
|
|
768
778
|
// Activation rules
|
|
769
779
|
requiresPreviousPhaseCompletion Boolean @default(true)
|
|
770
780
|
minimumCompletionPercentage Float?
|
|
@@ -879,11 +889,11 @@ model Contract {
|
|
|
879
889
|
updatedAt DateTime @updatedAt
|
|
880
890
|
|
|
881
891
|
// Relations
|
|
882
|
-
phases
|
|
883
|
-
documents
|
|
884
|
-
payments
|
|
885
|
-
transitions
|
|
886
|
-
events
|
|
892
|
+
phases ContractPhase[]
|
|
893
|
+
documents ContractDocument[]
|
|
894
|
+
payments ContractPayment[]
|
|
895
|
+
transitions ContractTransition[]
|
|
896
|
+
events ContractEvent[]
|
|
887
897
|
terminations ContractTermination[]
|
|
888
898
|
|
|
889
899
|
// Prequalification that led to this contract (optional)
|
|
@@ -928,6 +938,11 @@ model ContractPhase {
|
|
|
928
938
|
remainingAmount Float?
|
|
929
939
|
interestRate Float?
|
|
930
940
|
|
|
941
|
+
// Fund collection behavior (snapshotted from template at contract creation)
|
|
942
|
+
// true = we collect funds via wallet/gateway (e.g., downpayment)
|
|
943
|
+
// false = external payment, we only track/reconcile (e.g., bank mortgage)
|
|
944
|
+
collectFunds Boolean @default(true)
|
|
945
|
+
|
|
931
946
|
// Progress counters (for efficient activation checks)
|
|
932
947
|
approvedDocumentsCount Int @default(0)
|
|
933
948
|
requiredDocumentsCount Int @default(0)
|
|
@@ -1183,62 +1198,62 @@ model ContractTermination {
|
|
|
1183
1198
|
requestNumber String @unique // TRM-XXXXXX
|
|
1184
1199
|
|
|
1185
1200
|
// Who initiated and why
|
|
1186
|
-
initiatedBy
|
|
1187
|
-
initiatorId
|
|
1188
|
-
initiator
|
|
1189
|
-
type
|
|
1190
|
-
reason
|
|
1191
|
-
supportingDocs Json?
|
|
1201
|
+
initiatedBy TerminationInitiator
|
|
1202
|
+
initiatorId String? // userId if BUYER/SELLER/ADMIN
|
|
1203
|
+
initiator User? @relation("TerminationInitiator", fields: [initiatorId], references: [id])
|
|
1204
|
+
type TerminationType
|
|
1205
|
+
reason String? @db.Text
|
|
1206
|
+
supportingDocs Json? // [{type, url, uploadedAt}]
|
|
1192
1207
|
|
|
1193
1208
|
// Workflow status
|
|
1194
|
-
status
|
|
1195
|
-
requiresApproval
|
|
1196
|
-
autoApproveEligible Boolean
|
|
1209
|
+
status TerminationStatus @default(REQUESTED)
|
|
1210
|
+
requiresApproval Boolean @default(true)
|
|
1211
|
+
autoApproveEligible Boolean @default(false) // Pre-signature, no payments
|
|
1197
1212
|
|
|
1198
1213
|
// Admin review
|
|
1199
|
-
reviewedBy
|
|
1200
|
-
reviewer
|
|
1201
|
-
reviewedAt
|
|
1202
|
-
reviewNotes
|
|
1203
|
-
rejectionReason String?
|
|
1214
|
+
reviewedBy String?
|
|
1215
|
+
reviewer User? @relation("TerminationReviewer", fields: [reviewedBy], references: [id])
|
|
1216
|
+
reviewedAt DateTime?
|
|
1217
|
+
reviewNotes String? @db.Text
|
|
1218
|
+
rejectionReason String? @db.Text
|
|
1204
1219
|
|
|
1205
1220
|
// Financial snapshot at time of request
|
|
1206
|
-
contractSnapshot
|
|
1221
|
+
contractSnapshot Json // Full contract state snapshot
|
|
1207
1222
|
totalContractAmount Float
|
|
1208
1223
|
totalPaidToDate Float
|
|
1209
1224
|
outstandingBalance Float
|
|
1210
1225
|
|
|
1211
1226
|
// Settlement calculation
|
|
1212
|
-
refundableAmount
|
|
1213
|
-
penaltyAmount
|
|
1214
|
-
forfeitedAmount
|
|
1215
|
-
adminFeeAmount
|
|
1216
|
-
netRefundAmount
|
|
1217
|
-
settlementNotes
|
|
1227
|
+
refundableAmount Float @default(0) // Amount eligible for refund
|
|
1228
|
+
penaltyAmount Float @default(0) // Penalties/fees to deduct
|
|
1229
|
+
forfeitedAmount Float @default(0) // Amount forfeited (non-refundable deposits)
|
|
1230
|
+
adminFeeAmount Float @default(0) // Processing fees
|
|
1231
|
+
netRefundAmount Float @default(0) // refundableAmount - penaltyAmount - adminFeeAmount
|
|
1232
|
+
settlementNotes String? @db.Text
|
|
1218
1233
|
|
|
1219
1234
|
// Refund processing
|
|
1220
|
-
refundStatus
|
|
1221
|
-
refundReference
|
|
1222
|
-
refundMethod
|
|
1223
|
-
refundAccountDetails Json?
|
|
1224
|
-
refundInitiatedAt
|
|
1225
|
-
refundCompletedAt
|
|
1226
|
-
refundFailureReason
|
|
1235
|
+
refundStatus RefundStatus @default(NOT_APPLICABLE)
|
|
1236
|
+
refundReference String? // Payment gateway reference
|
|
1237
|
+
refundMethod String? // ORIGINAL_METHOD, BANK_TRANSFER, CHECK, WALLET
|
|
1238
|
+
refundAccountDetails Json? // Encrypted bank details if needed
|
|
1239
|
+
refundInitiatedAt DateTime?
|
|
1240
|
+
refundCompletedAt DateTime?
|
|
1241
|
+
refundFailureReason String? @db.Text
|
|
1227
1242
|
|
|
1228
1243
|
// Property unit handling
|
|
1229
1244
|
unitReleasedAt DateTime?
|
|
1230
|
-
unitReservedForId String?
|
|
1245
|
+
unitReservedForId String? // If unit being held for another buyer
|
|
1231
1246
|
|
|
1232
1247
|
// Timing
|
|
1233
|
-
requestedAt
|
|
1234
|
-
approvedAt
|
|
1235
|
-
executedAt
|
|
1236
|
-
completedAt
|
|
1237
|
-
cancelledAt
|
|
1248
|
+
requestedAt DateTime @default(now())
|
|
1249
|
+
approvedAt DateTime?
|
|
1250
|
+
executedAt DateTime?
|
|
1251
|
+
completedAt DateTime?
|
|
1252
|
+
cancelledAt DateTime?
|
|
1238
1253
|
|
|
1239
1254
|
// Idempotency and audit
|
|
1240
|
-
idempotencyKey
|
|
1241
|
-
metadata
|
|
1255
|
+
idempotencyKey String? @unique
|
|
1256
|
+
metadata Json?
|
|
1242
1257
|
|
|
1243
1258
|
createdAt DateTime @default(now())
|
|
1244
1259
|
updatedAt DateTime @updatedAt
|