@valentine-efagene/qshelter-common 2.0.102 → 2.0.103
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 +10 -0
- package/dist/generated/client/client.d.ts +10 -0
- package/dist/generated/client/commonInputTypes.d.ts +84 -84
- package/dist/generated/client/internal/class.d.ts +22 -0
- package/dist/generated/client/internal/class.js +2 -2
- package/dist/generated/client/internal/prismaNamespace.d.ts +182 -5
- package/dist/generated/client/internal/prismaNamespace.js +39 -0
- package/dist/generated/client/internal/prismaNamespaceBrowser.d.ts +43 -0
- package/dist/generated/client/internal/prismaNamespaceBrowser.js +39 -0
- package/dist/generated/client/models/DocumentationPhase.d.ts +231 -1
- package/dist/generated/client/models/DocumentationPlan.d.ts +1555 -0
- package/dist/generated/client/models/DocumentationPlan.js +1 -0
- package/dist/generated/client/models/DocumentationPlanStep.d.ts +1220 -0
- package/dist/generated/client/models/DocumentationPlanStep.js +1 -0
- package/dist/generated/client/models/PaymentMethodPhaseStep.d.ts +0 -3
- package/dist/generated/client/models/PropertyPaymentMethodPhase.d.ts +287 -1
- package/dist/generated/client/models/Tenant.d.ts +541 -0
- package/dist/generated/client/models/index.d.ts +2 -0
- package/dist/generated/client/models/index.js +2 -0
- package/dist/generated/client/models.d.ts +2 -0
- package/dist/src/prisma/tenant.js +2 -0
- package/package.json +1 -1
- package/prisma/migrations/20260114034523_add_documentation_plan/migration.sql +52 -0
- package/prisma/schema.prisma +72 -8
|
@@ -12,6 +12,8 @@ export * from './DeviceEndpoint';
|
|
|
12
12
|
export * from './DocumentRequirementRule';
|
|
13
13
|
export * from './DocumentTemplate';
|
|
14
14
|
export * from './DocumentationPhase';
|
|
15
|
+
export * from './DocumentationPlan';
|
|
16
|
+
export * from './DocumentationPlanStep';
|
|
15
17
|
export * from './DocumentationStep';
|
|
16
18
|
export * from './DocumentationStepApproval';
|
|
17
19
|
export * from './DocumentationStepDocument';
|
|
@@ -12,6 +12,8 @@ export * from './DeviceEndpoint';
|
|
|
12
12
|
export * from './DocumentRequirementRule';
|
|
13
13
|
export * from './DocumentTemplate';
|
|
14
14
|
export * from './DocumentationPhase';
|
|
15
|
+
export * from './DocumentationPlan';
|
|
16
|
+
export * from './DocumentationPlanStep';
|
|
15
17
|
export * from './DocumentationStep';
|
|
16
18
|
export * from './DocumentationStepApproval';
|
|
17
19
|
export * from './DocumentationStepDocument';
|
|
@@ -25,6 +25,8 @@ export type * from './models/PropertyVariantAmenity.js';
|
|
|
25
25
|
export type * from './models/PropertyVariantMedia.js';
|
|
26
26
|
export type * from './models/PropertyUnit.js';
|
|
27
27
|
export type * from './models/PropertyAmenity.js';
|
|
28
|
+
export type * from './models/DocumentationPlan.js';
|
|
29
|
+
export type * from './models/DocumentationPlanStep.js';
|
|
28
30
|
export type * from './models/PaymentPlan.js';
|
|
29
31
|
export type * from './models/PropertyPaymentMethod.js';
|
|
30
32
|
export type * from './models/PropertyPaymentMethodLink.js';
|
|
@@ -28,6 +28,8 @@ const GLOBAL_MODELS = [
|
|
|
28
28
|
*/
|
|
29
29
|
const OPTIONAL_TENANT_MODELS = [
|
|
30
30
|
"paymentPlan",
|
|
31
|
+
// DocumentationPlan can be global template (tenantId = null) or tenant-specific
|
|
32
|
+
"documentationPlan",
|
|
31
33
|
// Role can be global template (tenantId = null) or tenant-specific
|
|
32
34
|
"role",
|
|
33
35
|
// Permission can be global template or tenant-specific
|
package/package.json
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
-- AlterTable
|
|
2
|
+
ALTER TABLE `documentation_phases` ADD COLUMN `documentationPlanId` VARCHAR(191) NULL;
|
|
3
|
+
|
|
4
|
+
-- AlterTable
|
|
5
|
+
ALTER TABLE `property_payment_method_phases` ADD COLUMN `documentationPlanId` VARCHAR(191) NULL;
|
|
6
|
+
|
|
7
|
+
-- CreateTable
|
|
8
|
+
CREATE TABLE `documentation_plans` (
|
|
9
|
+
`id` VARCHAR(191) NOT NULL,
|
|
10
|
+
`tenantId` VARCHAR(191) NULL,
|
|
11
|
+
`name` VARCHAR(191) NOT NULL,
|
|
12
|
+
`description` TEXT NULL,
|
|
13
|
+
`isActive` BOOLEAN NOT NULL DEFAULT true,
|
|
14
|
+
`requiredDocumentTypes` JSON NULL,
|
|
15
|
+
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
16
|
+
`updatedAt` DATETIME(3) NOT NULL,
|
|
17
|
+
|
|
18
|
+
INDEX `documentation_plans_tenantId_idx`(`tenantId`),
|
|
19
|
+
UNIQUE INDEX `documentation_plans_tenantId_name_key`(`tenantId`, `name`),
|
|
20
|
+
PRIMARY KEY (`id`)
|
|
21
|
+
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
22
|
+
|
|
23
|
+
-- CreateTable
|
|
24
|
+
CREATE TABLE `documentation_plan_steps` (
|
|
25
|
+
`id` VARCHAR(191) NOT NULL,
|
|
26
|
+
`planId` VARCHAR(191) NOT NULL,
|
|
27
|
+
`name` VARCHAR(191) NOT NULL,
|
|
28
|
+
`stepType` ENUM('UPLOAD', 'REVIEW', 'SIGNATURE', 'APPROVAL', 'EXTERNAL_CHECK', 'WAIT', 'GENERATE_DOCUMENT', 'PRE_APPROVAL', 'UNDERWRITING') NOT NULL,
|
|
29
|
+
`order` INTEGER NOT NULL,
|
|
30
|
+
`documentType` VARCHAR(191) NULL,
|
|
31
|
+
`metadata` JSON NULL,
|
|
32
|
+
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
33
|
+
`updatedAt` DATETIME(3) NOT NULL,
|
|
34
|
+
|
|
35
|
+
INDEX `documentation_plan_steps_planId_idx`(`planId`),
|
|
36
|
+
PRIMARY KEY (`id`)
|
|
37
|
+
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
38
|
+
|
|
39
|
+
-- CreateIndex
|
|
40
|
+
CREATE INDEX `property_payment_method_phases_documentationPlanId_idx` ON `property_payment_method_phases`(`documentationPlanId`);
|
|
41
|
+
|
|
42
|
+
-- AddForeignKey
|
|
43
|
+
ALTER TABLE `documentation_plans` ADD CONSTRAINT `documentation_plans_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
44
|
+
|
|
45
|
+
-- AddForeignKey
|
|
46
|
+
ALTER TABLE `documentation_plan_steps` ADD CONSTRAINT `documentation_plan_steps_planId_fkey` FOREIGN KEY (`planId`) REFERENCES `documentation_plans`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
47
|
+
|
|
48
|
+
-- AddForeignKey
|
|
49
|
+
ALTER TABLE `property_payment_method_phases` ADD CONSTRAINT `property_payment_method_phases_documentationPlanId_fkey` FOREIGN KEY (`documentationPlanId`) REFERENCES `documentation_plans`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
50
|
+
|
|
51
|
+
-- AddForeignKey
|
|
52
|
+
ALTER TABLE `documentation_phases` ADD CONSTRAINT `documentation_phases_documentationPlanId_fkey` FOREIGN KEY (`documentationPlanId`) REFERENCES `documentation_plans`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
package/prisma/schema.prisma
CHANGED
|
@@ -492,11 +492,12 @@ model Tenant {
|
|
|
492
492
|
updatedAt DateTime @updatedAt
|
|
493
493
|
|
|
494
494
|
// Back-relations for multitenancy
|
|
495
|
-
users
|
|
496
|
-
properties
|
|
497
|
-
paymentPlans
|
|
498
|
-
|
|
499
|
-
|
|
495
|
+
users User[]
|
|
496
|
+
properties Property[]
|
|
497
|
+
paymentPlans PaymentPlan[]
|
|
498
|
+
documentationPlans DocumentationPlan[]
|
|
499
|
+
paymentMethods PropertyPaymentMethod[]
|
|
500
|
+
applications Application[]
|
|
500
501
|
|
|
501
502
|
// RBAC: Tenant-scoped roles and permissions
|
|
502
503
|
roles Role[]
|
|
@@ -1023,6 +1024,59 @@ model PropertyAmenity {
|
|
|
1023
1024
|
@@map("property_amenities")
|
|
1024
1025
|
}
|
|
1025
1026
|
|
|
1027
|
+
// =============================================================================
|
|
1028
|
+
// DOCUMENTATION PLAN DOMAIN - Reusable step workflow templates
|
|
1029
|
+
// =============================================================================
|
|
1030
|
+
|
|
1031
|
+
// DocumentationPlan = reusable structure for documentation workflows
|
|
1032
|
+
// Examples: "Standard KYC", "Quick Verification", "Full Underwriting"
|
|
1033
|
+
model DocumentationPlan {
|
|
1034
|
+
id String @id @default(cuid())
|
|
1035
|
+
tenantId String? // NULL = global template available to all tenants
|
|
1036
|
+
tenant Tenant? @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
1037
|
+
name String
|
|
1038
|
+
description String? @db.Text
|
|
1039
|
+
isActive Boolean @default(true)
|
|
1040
|
+
|
|
1041
|
+
// Document requirements for this plan
|
|
1042
|
+
requiredDocumentTypes Json? // Array of document type strings, e.g., ["ID_CARD", "BANK_STATEMENT"]
|
|
1043
|
+
|
|
1044
|
+
createdAt DateTime @default(now())
|
|
1045
|
+
updatedAt DateTime @updatedAt
|
|
1046
|
+
|
|
1047
|
+
// Steps that make up this plan
|
|
1048
|
+
steps DocumentationPlanStep[]
|
|
1049
|
+
// Used by property payment method phases (templates)
|
|
1050
|
+
methodPhases PropertyPaymentMethodPhase[]
|
|
1051
|
+
// Used by instantiated documentation phases
|
|
1052
|
+
documentationPhases DocumentationPhase[]
|
|
1053
|
+
|
|
1054
|
+
@@unique([tenantId, name]) // Unique per tenant, or globally if tenantId is null
|
|
1055
|
+
@@index([tenantId])
|
|
1056
|
+
@@map("documentation_plans")
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
// Step template within a DocumentationPlan
|
|
1060
|
+
model DocumentationPlanStep {
|
|
1061
|
+
id String @id @default(cuid())
|
|
1062
|
+
planId String
|
|
1063
|
+
plan DocumentationPlan @relation(fields: [planId], references: [id], onDelete: Cascade)
|
|
1064
|
+
|
|
1065
|
+
name String
|
|
1066
|
+
stepType StepType
|
|
1067
|
+
order Int
|
|
1068
|
+
|
|
1069
|
+
// Optional: which document type this step handles (for UPLOAD steps)
|
|
1070
|
+
documentType String?
|
|
1071
|
+
metadata Json?
|
|
1072
|
+
|
|
1073
|
+
createdAt DateTime @default(now())
|
|
1074
|
+
updatedAt DateTime @updatedAt
|
|
1075
|
+
|
|
1076
|
+
@@index([planId])
|
|
1077
|
+
@@map("documentation_plan_steps")
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1026
1080
|
// =============================================================================
|
|
1027
1081
|
// PAYMENT PLAN DOMAIN - Reusable installment structure templates
|
|
1028
1082
|
// =============================================================================
|
|
@@ -1142,8 +1196,12 @@ model PropertyPaymentMethodPhase {
|
|
|
1142
1196
|
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
1143
1197
|
paymentMethodId String
|
|
1144
1198
|
paymentMethod PropertyPaymentMethod @relation(fields: [paymentMethodId], references: [id], onDelete: Cascade)
|
|
1145
|
-
|
|
1146
|
-
|
|
1199
|
+
|
|
1200
|
+
// Plan references (only one should be set based on phaseCategory)
|
|
1201
|
+
paymentPlanId String? // Only for PAYMENT phases
|
|
1202
|
+
paymentPlan PaymentPlan? @relation(fields: [paymentPlanId], references: [id])
|
|
1203
|
+
documentationPlanId String? // Only for DOCUMENTATION phases
|
|
1204
|
+
documentationPlan DocumentationPlan? @relation(fields: [documentationPlanId], references: [id])
|
|
1147
1205
|
|
|
1148
1206
|
name String
|
|
1149
1207
|
description String? @db.Text
|
|
@@ -1168,13 +1226,14 @@ model PropertyPaymentMethodPhase {
|
|
|
1168
1226
|
completionCriterion CompletionCriterion?
|
|
1169
1227
|
|
|
1170
1228
|
// Snapshots for audit (original config at creation time)
|
|
1229
|
+
// These are still needed for inline definitions (backward compatibility)
|
|
1171
1230
|
stepDefinitionsSnapshot Json?
|
|
1172
1231
|
requiredDocumentSnapshot Json?
|
|
1173
1232
|
|
|
1174
1233
|
createdAt DateTime @default(now())
|
|
1175
1234
|
updatedAt DateTime @updatedAt
|
|
1176
1235
|
|
|
1177
|
-
// Normalized child tables (for DOCUMENTATION phases)
|
|
1236
|
+
// Normalized child tables (for DOCUMENTATION phases - inline definitions)
|
|
1178
1237
|
steps PaymentMethodPhaseStep[]
|
|
1179
1238
|
requiredDocuments PaymentMethodPhaseDocument[]
|
|
1180
1239
|
// Normalized child tables (for QUESTIONNAIRE phases)
|
|
@@ -1185,6 +1244,7 @@ model PropertyPaymentMethodPhase {
|
|
|
1185
1244
|
@@index([tenantId])
|
|
1186
1245
|
@@index([paymentMethodId])
|
|
1187
1246
|
@@index([paymentPlanId])
|
|
1247
|
+
@@index([documentationPlanId])
|
|
1188
1248
|
@@index([phaseCategory])
|
|
1189
1249
|
@@map("property_payment_method_phases")
|
|
1190
1250
|
}
|
|
@@ -1612,6 +1672,10 @@ model DocumentationPhase {
|
|
|
1612
1672
|
phaseId String @unique
|
|
1613
1673
|
phase ApplicationPhase @relation(fields: [phaseId], references: [id], onDelete: Cascade)
|
|
1614
1674
|
|
|
1675
|
+
// Documentation plan reference (if created from a plan)
|
|
1676
|
+
documentationPlanId String?
|
|
1677
|
+
documentationPlan DocumentationPlan? @relation(fields: [documentationPlanId], references: [id])
|
|
1678
|
+
|
|
1615
1679
|
// Current step pointer for UX and orchestration
|
|
1616
1680
|
currentStepId String?
|
|
1617
1681
|
currentStep DocumentationStep? @relation("CurrentStep", fields: [currentStepId], references: [id])
|