@valentine-efagene/qshelter-common 2.0.29 → 2.0.30
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/browser.d.ts +15 -0
- package/dist/generated/client/client.d.ts +15 -0
- package/dist/generated/client/commonInputTypes.d.ts +408 -48
- package/dist/generated/client/enums.d.ts +92 -0
- package/dist/generated/client/enums.js +80 -0
- package/dist/generated/client/internal/class.d.ts +33 -0
- package/dist/generated/client/internal/class.js +2 -2
- package/dist/generated/client/internal/prismaNamespace.d.ts +330 -36
- package/dist/generated/client/internal/prismaNamespace.js +76 -37
- package/dist/generated/client/internal/prismaNamespaceBrowser.d.ts +80 -35
- package/dist/generated/client/internal/prismaNamespaceBrowser.js +76 -37
- package/dist/generated/client/models/Contract.d.ts +152 -148
- package/dist/generated/client/models/ContractDocument.d.ts +32 -28
- package/dist/generated/client/models/ContractInstallment.d.ts +30 -26
- package/dist/generated/client/models/ContractPayment.d.ts +44 -40
- package/dist/generated/client/models/ContractPhase.d.ts +539 -121
- package/dist/generated/client/models/ContractPhaseStep.d.ts +208 -108
- package/dist/generated/client/models/ContractPhaseStepApproval.d.ts +32 -28
- package/dist/generated/client/models/ContractPhaseStepDocument.d.ts +1052 -0
- package/dist/generated/client/models/ContractPhaseStepDocument.js +1 -0
- package/dist/generated/client/models/PaymentMethodPhaseDocument.d.ts +1216 -0
- package/dist/generated/client/models/PaymentMethodPhaseDocument.js +1 -0
- package/dist/generated/client/models/PaymentMethodPhaseStep.d.ts +1187 -0
- package/dist/generated/client/models/PaymentMethodPhaseStep.js +1 -0
- package/dist/generated/client/models/PaymentPlan.d.ts +34 -30
- package/dist/generated/client/models/PropertyPaymentMethodPhase.d.ts +504 -135
- package/dist/generated/client/models/index.d.ts +3 -0
- package/dist/generated/client/models/index.js +3 -0
- package/dist/generated/client/models.d.ts +3 -0
- package/package.json +1 -1
- package/prisma/schema.prisma +195 -30
|
@@ -7,6 +7,7 @@ export * from './ContractPayment';
|
|
|
7
7
|
export * from './ContractPhase';
|
|
8
8
|
export * from './ContractPhaseStep';
|
|
9
9
|
export * from './ContractPhaseStepApproval';
|
|
10
|
+
export * from './ContractPhaseStepDocument';
|
|
10
11
|
export * from './ContractTransition';
|
|
11
12
|
export * from './DeviceEndpoint';
|
|
12
13
|
export * from './DocumentRequirementRule';
|
|
@@ -15,6 +16,8 @@ export * from './EmailPreference';
|
|
|
15
16
|
export * from './OAuthState';
|
|
16
17
|
export * from './PasswordReset';
|
|
17
18
|
export * from './PaymentMethodChangeRequest';
|
|
19
|
+
export * from './PaymentMethodPhaseDocument';
|
|
20
|
+
export * from './PaymentMethodPhaseStep';
|
|
18
21
|
export * from './PaymentPlan';
|
|
19
22
|
export * from './Permission';
|
|
20
23
|
export * from './Prequalification';
|
|
@@ -7,6 +7,7 @@ export * from './ContractPayment';
|
|
|
7
7
|
export * from './ContractPhase';
|
|
8
8
|
export * from './ContractPhaseStep';
|
|
9
9
|
export * from './ContractPhaseStepApproval';
|
|
10
|
+
export * from './ContractPhaseStepDocument';
|
|
10
11
|
export * from './ContractTransition';
|
|
11
12
|
export * from './DeviceEndpoint';
|
|
12
13
|
export * from './DocumentRequirementRule';
|
|
@@ -15,6 +16,8 @@ export * from './EmailPreference';
|
|
|
15
16
|
export * from './OAuthState';
|
|
16
17
|
export * from './PasswordReset';
|
|
17
18
|
export * from './PaymentMethodChangeRequest';
|
|
19
|
+
export * from './PaymentMethodPhaseDocument';
|
|
20
|
+
export * from './PaymentMethodPhaseStep';
|
|
18
21
|
export * from './PaymentPlan';
|
|
19
22
|
export * from './Permission';
|
|
20
23
|
export * from './Prequalification';
|
|
@@ -27,9 +27,12 @@ export type * from './models/PaymentPlan.js';
|
|
|
27
27
|
export type * from './models/PropertyPaymentMethod.js';
|
|
28
28
|
export type * from './models/PropertyPaymentMethodLink.js';
|
|
29
29
|
export type * from './models/PropertyPaymentMethodPhase.js';
|
|
30
|
+
export type * from './models/PaymentMethodPhaseStep.js';
|
|
31
|
+
export type * from './models/PaymentMethodPhaseDocument.js';
|
|
30
32
|
export type * from './models/Contract.js';
|
|
31
33
|
export type * from './models/ContractPhase.js';
|
|
32
34
|
export type * from './models/ContractPhaseStep.js';
|
|
35
|
+
export type * from './models/ContractPhaseStepDocument.js';
|
|
33
36
|
export type * from './models/ContractPhaseStepApproval.js';
|
|
34
37
|
export type * from './models/ContractInstallment.js';
|
|
35
38
|
export type * from './models/ContractPayment.js';
|
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -15,6 +15,102 @@ datasource db {
|
|
|
15
15
|
provider = "mysql"
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
// =============================================================================
|
|
19
|
+
// ENUMS - Database-enforced value constraints
|
|
20
|
+
// =============================================================================
|
|
21
|
+
|
|
22
|
+
enum PhaseCategory {
|
|
23
|
+
DOCUMENTATION
|
|
24
|
+
PAYMENT
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
enum PhaseType {
|
|
28
|
+
KYC
|
|
29
|
+
VERIFICATION
|
|
30
|
+
DOWNPAYMENT
|
|
31
|
+
MORTGAGE
|
|
32
|
+
BALLOON
|
|
33
|
+
CUSTOM
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
enum PaymentFrequency {
|
|
37
|
+
MONTHLY
|
|
38
|
+
BIWEEKLY
|
|
39
|
+
WEEKLY
|
|
40
|
+
ONE_TIME
|
|
41
|
+
CUSTOM
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
enum ContractStatus {
|
|
45
|
+
DRAFT
|
|
46
|
+
PENDING
|
|
47
|
+
ACTIVE
|
|
48
|
+
COMPLETED
|
|
49
|
+
CANCELLED
|
|
50
|
+
TERMINATED
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
enum PhaseStatus {
|
|
54
|
+
PENDING
|
|
55
|
+
IN_PROGRESS
|
|
56
|
+
AWAITING_APPROVAL
|
|
57
|
+
ACTIVE
|
|
58
|
+
COMPLETED
|
|
59
|
+
SKIPPED
|
|
60
|
+
FAILED
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
enum StepType {
|
|
64
|
+
UPLOAD
|
|
65
|
+
REVIEW
|
|
66
|
+
SIGNATURE
|
|
67
|
+
APPROVAL
|
|
68
|
+
EXTERNAL_CHECK
|
|
69
|
+
WAIT
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
enum StepStatus {
|
|
73
|
+
PENDING
|
|
74
|
+
IN_PROGRESS
|
|
75
|
+
COMPLETED
|
|
76
|
+
FAILED
|
|
77
|
+
SKIPPED
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
enum InstallmentStatus {
|
|
81
|
+
PENDING
|
|
82
|
+
PAID
|
|
83
|
+
OVERDUE
|
|
84
|
+
PARTIALLY_PAID
|
|
85
|
+
WAIVED
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
enum PaymentStatus {
|
|
89
|
+
INITIATED
|
|
90
|
+
PENDING
|
|
91
|
+
COMPLETED
|
|
92
|
+
FAILED
|
|
93
|
+
REFUNDED
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
enum ApprovalDecision {
|
|
97
|
+
APPROVED
|
|
98
|
+
REJECTED
|
|
99
|
+
REQUEST_CHANGES
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
enum CompletionCriterion {
|
|
103
|
+
DOCUMENT_APPROVALS
|
|
104
|
+
PAYMENT_AMOUNT
|
|
105
|
+
STEPS_COMPLETED
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
enum DocumentStatus {
|
|
109
|
+
PENDING
|
|
110
|
+
APPROVED
|
|
111
|
+
REJECTED
|
|
112
|
+
}
|
|
113
|
+
|
|
18
114
|
// =============================================================================
|
|
19
115
|
// USER & AUTH DOMAIN
|
|
20
116
|
// =============================================================================
|
|
@@ -515,11 +611,11 @@ model PaymentPlan {
|
|
|
515
611
|
isActive Boolean @default(true)
|
|
516
612
|
|
|
517
613
|
// Structure configuration
|
|
518
|
-
paymentFrequency
|
|
614
|
+
paymentFrequency PaymentFrequency
|
|
519
615
|
customFrequencyDays Int?
|
|
520
616
|
numberOfInstallments Int // 1 for one-time, 360 for 30yr monthly, etc
|
|
521
|
-
calculateInterestDaily Boolean
|
|
522
|
-
gracePeriodDays Int
|
|
617
|
+
calculateInterestDaily Boolean @default(false)
|
|
618
|
+
gracePeriodDays Int @default(0)
|
|
523
619
|
|
|
524
620
|
createdAt DateTime @default(now())
|
|
525
621
|
updatedAt DateTime @updatedAt
|
|
@@ -608,9 +704,9 @@ model PropertyPaymentMethodPhase {
|
|
|
608
704
|
name String
|
|
609
705
|
description String? @db.Text
|
|
610
706
|
|
|
611
|
-
// Phase classification
|
|
612
|
-
phaseCategory
|
|
613
|
-
phaseType
|
|
707
|
+
// Phase classification (DB-enforced enums)
|
|
708
|
+
phaseCategory PhaseCategory
|
|
709
|
+
phaseType PhaseType
|
|
614
710
|
order Int
|
|
615
711
|
|
|
616
712
|
// Financial configuration (for PAYMENT phases)
|
|
@@ -618,22 +714,64 @@ model PropertyPaymentMethodPhase {
|
|
|
618
714
|
percentOfPrice Float? // e.g., 10.0 for 10% downpayment
|
|
619
715
|
|
|
620
716
|
// Activation rules
|
|
621
|
-
requiresPreviousPhaseCompletion Boolean
|
|
717
|
+
requiresPreviousPhaseCompletion Boolean @default(true)
|
|
622
718
|
minimumCompletionPercentage Float?
|
|
719
|
+
completionCriterion CompletionCriterion?
|
|
623
720
|
|
|
624
|
-
//
|
|
625
|
-
|
|
626
|
-
|
|
721
|
+
// Snapshots for audit (original config at creation time)
|
|
722
|
+
stepDefinitionsSnapshot Json?
|
|
723
|
+
requiredDocumentSnapshot Json?
|
|
627
724
|
|
|
628
725
|
createdAt DateTime @default(now())
|
|
629
726
|
updatedAt DateTime @updatedAt
|
|
630
727
|
|
|
728
|
+
// Normalized child tables (for DOCUMENTATION phases)
|
|
729
|
+
steps PaymentMethodPhaseStep[]
|
|
730
|
+
requiredDocuments PaymentMethodPhaseDocument[]
|
|
731
|
+
|
|
631
732
|
@@index([paymentMethodId])
|
|
632
733
|
@@index([paymentPlanId])
|
|
633
734
|
@@index([phaseCategory])
|
|
634
735
|
@@map("property_payment_method_phases")
|
|
635
736
|
}
|
|
636
737
|
|
|
738
|
+
// Step template within a DOCUMENTATION phase
|
|
739
|
+
model PaymentMethodPhaseStep {
|
|
740
|
+
id String @id @default(cuid())
|
|
741
|
+
phaseId String
|
|
742
|
+
phase PropertyPaymentMethodPhase @relation(fields: [phaseId], references: [id], onDelete: Cascade)
|
|
743
|
+
|
|
744
|
+
name String
|
|
745
|
+
stepType StepType
|
|
746
|
+
order Int
|
|
747
|
+
|
|
748
|
+
metadata Json?
|
|
749
|
+
createdAt DateTime @default(now())
|
|
750
|
+
updatedAt DateTime @updatedAt
|
|
751
|
+
|
|
752
|
+
@@index([phaseId])
|
|
753
|
+
@@map("payment_method_phase_steps")
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
// Required document within a DOCUMENTATION phase
|
|
757
|
+
model PaymentMethodPhaseDocument {
|
|
758
|
+
id String @id @default(cuid())
|
|
759
|
+
phaseId String
|
|
760
|
+
phase PropertyPaymentMethodPhase @relation(fields: [phaseId], references: [id], onDelete: Cascade)
|
|
761
|
+
|
|
762
|
+
documentType String
|
|
763
|
+
isRequired Boolean @default(true)
|
|
764
|
+
description String? @db.Text
|
|
765
|
+
allowedMimeTypes String? // CSV: application/pdf,image/jpeg
|
|
766
|
+
maxSizeBytes Int?
|
|
767
|
+
|
|
768
|
+
metadata Json?
|
|
769
|
+
createdAt DateTime @default(now())
|
|
770
|
+
|
|
771
|
+
@@index([phaseId, documentType])
|
|
772
|
+
@@map("payment_method_phase_documents")
|
|
773
|
+
}
|
|
774
|
+
|
|
637
775
|
// =============================================================================
|
|
638
776
|
// CONTRACT DOMAIN - Unified agreement model (replaces Mortgage, PurchasePlan, etc.)
|
|
639
777
|
// =============================================================================
|
|
@@ -673,9 +811,9 @@ model Contract {
|
|
|
673
811
|
totalPaidToDate Float @default(0)
|
|
674
812
|
totalInterestPaid Float @default(0)
|
|
675
813
|
|
|
676
|
-
// FSM state
|
|
677
|
-
status
|
|
678
|
-
state
|
|
814
|
+
// FSM state (DB-enforced enums)
|
|
815
|
+
status ContractStatus @default(DRAFT)
|
|
816
|
+
state ContractStatus @default(DRAFT) // FSM state for workflow
|
|
679
817
|
currentPhaseId String?
|
|
680
818
|
|
|
681
819
|
// Timing
|
|
@@ -723,13 +861,13 @@ model ContractPhase {
|
|
|
723
861
|
name String
|
|
724
862
|
description String? @db.Text
|
|
725
863
|
|
|
726
|
-
// Phase classification
|
|
727
|
-
phaseCategory
|
|
728
|
-
phaseType
|
|
864
|
+
// Phase classification (DB-enforced enums)
|
|
865
|
+
phaseCategory PhaseCategory
|
|
866
|
+
phaseType PhaseType
|
|
729
867
|
order Int
|
|
730
868
|
|
|
731
|
-
// FSM state for this phase
|
|
732
|
-
status
|
|
869
|
+
// FSM state for this phase (DB-enforced enum)
|
|
870
|
+
status PhaseStatus @default(PENDING)
|
|
733
871
|
|
|
734
872
|
// Financial details (for PAYMENT phases)
|
|
735
873
|
totalAmount Float?
|
|
@@ -737,6 +875,12 @@ model ContractPhase {
|
|
|
737
875
|
remainingAmount Float?
|
|
738
876
|
interestRate Float?
|
|
739
877
|
|
|
878
|
+
// Progress counters (for efficient activation checks)
|
|
879
|
+
approvedDocumentsCount Int @default(0)
|
|
880
|
+
requiredDocumentsCount Int @default(0)
|
|
881
|
+
completedStepsCount Int @default(0)
|
|
882
|
+
totalStepsCount Int @default(0)
|
|
883
|
+
|
|
740
884
|
// Timing
|
|
741
885
|
dueDate DateTime?
|
|
742
886
|
startDate DateTime?
|
|
@@ -745,8 +889,14 @@ model ContractPhase {
|
|
|
745
889
|
completedAt DateTime?
|
|
746
890
|
|
|
747
891
|
// Activation rules
|
|
748
|
-
requiresPreviousPhaseCompletion Boolean
|
|
892
|
+
requiresPreviousPhaseCompletion Boolean @default(true)
|
|
749
893
|
minimumCompletionPercentage Float?
|
|
894
|
+
completionCriterion CompletionCriterion?
|
|
895
|
+
|
|
896
|
+
// Snapshots for audit (effective config at contract creation)
|
|
897
|
+
paymentPlanSnapshot Json?
|
|
898
|
+
stepDefinitionsSnapshot Json?
|
|
899
|
+
requiredDocumentSnapshot Json?
|
|
750
900
|
|
|
751
901
|
createdAt DateTime @default(now())
|
|
752
902
|
updatedAt DateTime @updatedAt
|
|
@@ -771,18 +921,18 @@ model ContractPhaseStep {
|
|
|
771
921
|
phase ContractPhase @relation(fields: [phaseId], references: [id], onDelete: Cascade)
|
|
772
922
|
|
|
773
923
|
name String
|
|
774
|
-
description String?
|
|
775
|
-
stepType
|
|
924
|
+
description String? @db.Text
|
|
925
|
+
stepType StepType
|
|
776
926
|
order Int
|
|
777
927
|
|
|
778
|
-
status
|
|
928
|
+
status StepStatus @default(PENDING)
|
|
779
929
|
|
|
780
930
|
// Assignment
|
|
781
931
|
assigneeId String?
|
|
782
932
|
assignee User? @relation("PhaseStepAssignee", fields: [assigneeId], references: [id])
|
|
783
933
|
|
|
784
|
-
// Required document types for UPLOAD steps
|
|
785
|
-
|
|
934
|
+
// Required document types for UPLOAD steps (normalized)
|
|
935
|
+
requiredDocuments ContractPhaseStepDocument[]
|
|
786
936
|
|
|
787
937
|
// Timing
|
|
788
938
|
dueDate DateTime?
|
|
@@ -799,6 +949,21 @@ model ContractPhaseStep {
|
|
|
799
949
|
@@map("contract_phase_steps")
|
|
800
950
|
}
|
|
801
951
|
|
|
952
|
+
// Required documents for a step (normalized from CSV)
|
|
953
|
+
model ContractPhaseStepDocument {
|
|
954
|
+
id String @id @default(cuid())
|
|
955
|
+
stepId String
|
|
956
|
+
step ContractPhaseStep @relation(fields: [stepId], references: [id], onDelete: Cascade)
|
|
957
|
+
|
|
958
|
+
documentType String
|
|
959
|
+
isRequired Boolean @default(true)
|
|
960
|
+
|
|
961
|
+
createdAt DateTime @default(now())
|
|
962
|
+
|
|
963
|
+
@@index([stepId, documentType])
|
|
964
|
+
@@map("contract_phase_step_documents")
|
|
965
|
+
}
|
|
966
|
+
|
|
802
967
|
// Approvals for documentation steps
|
|
803
968
|
model ContractPhaseStepApproval {
|
|
804
969
|
id String @id @default(cuid())
|
|
@@ -807,9 +972,9 @@ model ContractPhaseStepApproval {
|
|
|
807
972
|
approverId String?
|
|
808
973
|
approver User? @relation("PhaseStepApprover", fields: [approverId], references: [id])
|
|
809
974
|
|
|
810
|
-
decision
|
|
811
|
-
comment String?
|
|
812
|
-
decidedAt DateTime
|
|
975
|
+
decision ApprovalDecision
|
|
976
|
+
comment String? @db.Text
|
|
977
|
+
decidedAt DateTime @default(now())
|
|
813
978
|
|
|
814
979
|
createdAt DateTime @default(now())
|
|
815
980
|
|
|
@@ -830,7 +995,7 @@ model ContractInstallment {
|
|
|
830
995
|
interestAmount Float @default(0)
|
|
831
996
|
|
|
832
997
|
dueDate DateTime
|
|
833
|
-
status
|
|
998
|
+
status InstallmentStatus @default(PENDING)
|
|
834
999
|
|
|
835
1000
|
paidAmount Float @default(0)
|
|
836
1001
|
paidDate DateTime?
|
|
@@ -869,7 +1034,7 @@ model ContractPayment {
|
|
|
869
1034
|
lateFeeAmount Float @default(0)
|
|
870
1035
|
|
|
871
1036
|
paymentMethod String // BANK_TRANSFER, CREDIT_CARD, WALLET, CASH, CHECK
|
|
872
|
-
status
|
|
1037
|
+
status PaymentStatus @default(INITIATED)
|
|
873
1038
|
|
|
874
1039
|
reference String? @unique
|
|
875
1040
|
gatewayResponse String? @db.Text // JSON
|
|
@@ -901,7 +1066,7 @@ model ContractDocument {
|
|
|
901
1066
|
uploadedById String?
|
|
902
1067
|
uploadedBy User? @relation("DocumentUploader", fields: [uploadedById], references: [id])
|
|
903
1068
|
|
|
904
|
-
status
|
|
1069
|
+
status DocumentStatus @default(PENDING)
|
|
905
1070
|
|
|
906
1071
|
createdAt DateTime @default(now())
|
|
907
1072
|
updatedAt DateTime @updatedAt
|