@valentine-efagene/qshelter-common 2.0.156 → 2.0.158

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.
Files changed (74) hide show
  1. package/dist/generated/client/browser.d.ts +1 -1
  2. package/dist/generated/client/client.d.ts +1 -1
  3. package/dist/generated/client/internal/class.js +2 -2
  4. package/dist/generated/client/internal/prismaNamespace.d.ts +2 -4
  5. package/dist/generated/client/internal/prismaNamespace.js +2 -4
  6. package/dist/generated/client/internal/prismaNamespaceBrowser.d.ts +2 -4
  7. package/dist/generated/client/internal/prismaNamespaceBrowser.js +2 -4
  8. package/dist/generated/client/models/BankDocumentRequirement.d.ts +90 -154
  9. package/dist/generated/client/models/PropertyPaymentMethod.d.ts +3 -192
  10. package/dist/generated/client/models/PropertyPaymentMethodPhase.d.ts +227 -4
  11. package/package.json +1 -1
  12. package/prisma/migrations/0_init/migration.sql +2327 -0
  13. package/prisma/schema.prisma +17 -18
  14. package/prisma/migrations/20251228081517_create_initial_tables/migration.sql +0 -707
  15. package/prisma/migrations/20251228083337_refresh_token_hash/migration.sql +0 -16
  16. package/prisma/migrations/20251228084551/migration.sql +0 -16
  17. package/prisma/migrations/20251230104059_add_property_variants/migration.sql +0 -622
  18. package/prisma/migrations/20251230113413_add_multitenancy/migration.sql +0 -54
  19. package/prisma/migrations/20251230231217_add_prequalification_and_payment_method_change/migration.sql +0 -137
  20. package/prisma/migrations/20260101081428_normalize_schema/migration.sql +0 -119
  21. package/prisma/migrations/20260101102022_add_contract_termination/migration.sql +0 -69
  22. package/prisma/migrations/20260101110958_add_collect_funds/migration.sql +0 -8
  23. package/prisma/migrations/20260104084843_add_document_templates_and_offer_letters/migration.sql +0 -77
  24. package/prisma/migrations/20260104095131_add_underwriting_decision/migration.sql +0 -31
  25. package/prisma/migrations/20260104170149_add_generate_document_step_type/migration.sql +0 -5
  26. package/prisma/migrations/20260104172349_add_metadata_to_contract_phase_step/migration.sql +0 -2
  27. package/prisma/migrations/20260104174626_make_offer_letter_template_optional/migration.sql +0 -11
  28. package/prisma/migrations/20260105004059_add_superseded_phase_status/migration.sql +0 -2
  29. package/prisma/migrations/20260105074701_add_underwriting_step_types/migration.sql +0 -17
  30. package/prisma/migrations/20260105080236_remove_prequalification_model/migration.sql +0 -37
  31. package/prisma/migrations/20260105081842_unify_contract_events/migration.sql +0 -37
  32. package/prisma/migrations/20260105085337_simplify_los_remove_prequalification/migration.sql +0 -1
  33. package/prisma/migrations/20260105094604_workflow_tracking_current_step/migration.sql +0 -14
  34. package/prisma/migrations/20260105130633_add_api_keys/migration.sql +0 -26
  35. package/prisma/migrations/20260105151535_add_event_workflow_system/migration.sql +0 -132
  36. package/prisma/migrations/20260105160757_add_sns_handler_type/migration.sql +0 -2
  37. package/prisma/migrations/20260106003757_business_friendly_handler_types/migration.sql +0 -28
  38. package/prisma/migrations/20260106062140_add_step_event_attachments/migration.sql +0 -22
  39. package/prisma/migrations/20260107121844_add_property_transfer_requests/migration.sql +0 -64
  40. package/prisma/migrations/20260107172301_add_approval_request_model/migration.sql +0 -46
  41. package/prisma/migrations/20260107214834_add_contract_refund_model/migration.sql +0 -64
  42. package/prisma/migrations/20260108051928_add_approval_request_type_status_index/migration.sql +0 -2
  43. package/prisma/migrations/20260109132751_update_transfer_flow/migration.sql +0 -343
  44. package/prisma/migrations/20260111091027_rbac_redesign_federated_users/migration.sql +0 -79
  45. package/prisma/migrations/20260112000006_add_phase_event_attachments/migration.sql +0 -22
  46. package/prisma/migrations/20260112041159_add_flexible_term_configuration/migration.sql +0 -11
  47. package/prisma/migrations/20260112080730_rename_contract_to_application/migration.sql +0 -293
  48. package/prisma/migrations/20260112081422_cleanup_rename_contract_to_application/migration.sql +0 -14
  49. package/prisma/migrations/20260113000000_remove_workflow_analytics_summary/migration.sql +0 -5
  50. package/prisma/migrations/20260113110450_add_tenant_id_to_child_models/migration.sql +0 -334
  51. package/prisma/migrations/20260113122855_add_tenant_to_remaining_models/migration.sql +0 -64
  52. package/prisma/migrations/20260114034523_add_documentation_plan/migration.sql +0 -52
  53. package/prisma/migrations/20260114053042_add_questionnaire_plan/migration.sql +0 -73
  54. package/prisma/migrations/20260114164044_add_condition_to_documentation_plan_step/migration.sql +0 -10
  55. package/prisma/migrations/20260115055636_add_unit_locking/migration.sql +0 -16
  56. package/prisma/migrations/20260115060132_add_phase_template_reference/migration.sql +0 -8
  57. package/prisma/migrations/20260115084033_add_gate_step_type/migration.sql +0 -29
  58. package/prisma/migrations/20260115123703_add_organizations/migration.sql +0 -69
  59. package/prisma/migrations/20260115125519_add_requires_manual_review_to_step/migration.sql +0 -2
  60. package/prisma/migrations/20260115134106_add_conditional_step_support/migration.sql +0 -11
  61. package/prisma/migrations/20260116090633_add_question_category_enum/migration.sql +0 -8
  62. package/prisma/migrations/20260116152051_add_multi_party_document_review/migration.sql +0 -59
  63. package/prisma/migrations/20260116153745_add_platform_organization_type/migration.sql +0 -3
  64. package/prisma/migrations/20260119180401_add_document_name_remove_required_doc_types/migration.sql +0 -14
  65. package/prisma/migrations/20260119190336_add_document_approval_workflow/migration.sql +0 -134
  66. package/prisma/migrations/20260120024650_add_questionnaire_phase_review/migration.sql +0 -102
  67. package/prisma/migrations/20260121155057_add_event_execution_and_bank_docs/migration.sql +0 -198
  68. package/prisma/migrations/20260121161937_add_phase_step_order_unique_constraints/migration.sql +0 -12
  69. package/prisma/migrations/20260121163910_add_optimistic_locking/migration.sql +0 -14
  70. package/prisma/migrations/20260125090213_remove_is_published_use_status_enum/migration.sql +0 -10
  71. package/prisma/migrations/20260125102448_org_types_many_to_many/migration.sql +0 -153
  72. package/prisma/migrations/20260125103700_20260125102448_org_types_many_to_many_fix/migration.sql +0 -5
  73. package/prisma/migrations/20260126031132_add_organization_id_to_property/migration.sql +0 -8
  74. package/prisma/migrations/migration_lock.toml +0 -3
@@ -1,343 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `phaseId` on the `contract_installments` table. All the data in the column will be lost.
5
- - You are about to drop the column `approvedDocumentsCount` on the `contract_phases` table. All the data in the column will be lost.
6
- - You are about to drop the column `collectFunds` on the `contract_phases` table. All the data in the column will be lost.
7
- - You are about to drop the column `completedStepsCount` on the `contract_phases` table. All the data in the column will be lost.
8
- - You are about to drop the column `completionCriterion` on the `contract_phases` table. All the data in the column will be lost.
9
- - You are about to drop the column `currentStepId` on the `contract_phases` table. All the data in the column will be lost.
10
- - You are about to drop the column `interestRate` on the `contract_phases` table. All the data in the column will be lost.
11
- - You are about to drop the column `minimumCompletionPercentage` on the `contract_phases` table. All the data in the column will be lost.
12
- - You are about to drop the column `paidAmount` on the `contract_phases` table. All the data in the column will be lost.
13
- - You are about to drop the column `paymentPlanId` on the `contract_phases` table. All the data in the column will be lost.
14
- - You are about to drop the column `paymentPlanSnapshot` on the `contract_phases` table. All the data in the column will be lost.
15
- - You are about to drop the column `remainingAmount` on the `contract_phases` table. All the data in the column will be lost.
16
- - You are about to drop the column `requiredDocumentSnapshot` on the `contract_phases` table. All the data in the column will be lost.
17
- - You are about to drop the column `requiredDocumentsCount` on the `contract_phases` table. All the data in the column will be lost.
18
- - You are about to drop the column `stepDefinitionsSnapshot` on the `contract_phases` table. All the data in the column will be lost.
19
- - You are about to drop the column `totalAmount` on the `contract_phases` table. All the data in the column will be lost.
20
- - You are about to drop the column `totalStepsCount` on the `contract_phases` table. All the data in the column will be lost.
21
- - You are about to drop the column `debtToIncomeRatio` on the `contracts` table. All the data in the column will be lost.
22
- - You are about to drop the column `downPayment` on the `contracts` table. All the data in the column will be lost.
23
- - You are about to drop the column `downPaymentPaid` on the `contracts` table. All the data in the column will be lost.
24
- - You are about to drop the column `interestRate` on the `contracts` table. All the data in the column will be lost.
25
- - You are about to drop the column `monthlyExpenses` on the `contracts` table. All the data in the column will be lost.
26
- - You are about to drop the column `monthlyIncome` on the `contracts` table. All the data in the column will be lost.
27
- - You are about to drop the column `periodicPayment` on the `contracts` table. All the data in the column will be lost.
28
- - You are about to drop the column `preApprovalAnswers` on the `contracts` table. All the data in the column will be lost.
29
- - You are about to drop the column `principal` on the `contracts` table. All the data in the column will be lost.
30
- - You are about to drop the column `state` on the `contracts` table. All the data in the column will be lost.
31
- - You are about to drop the column `termMonths` on the `contracts` table. All the data in the column will be lost.
32
- - You are about to drop the column `totalInterestPaid` on the `contracts` table. All the data in the column will be lost.
33
- - You are about to drop the column `totalPaidToDate` on the `contracts` table. All the data in the column will be lost.
34
- - You are about to drop the column `underwritingScore` on the `contracts` table. All the data in the column will be lost.
35
- - You are about to drop the column `paymentsMigrated` on the `property_transfer_requests` table. All the data in the column will be lost.
36
- - You are about to drop the `contract_phase_step_approvals` table. If the table is not empty, all the data it contains will be lost.
37
- - You are about to drop the `contract_phase_step_documents` table. If the table is not empty, all the data it contains will be lost.
38
- - You are about to drop the `contract_phase_steps` table. If the table is not empty, all the data it contains will be lost.
39
- - Added the required column `paymentPhaseId` to the `contract_installments` table without a default value. This is not possible if the table is not empty.
40
-
41
- */
42
- -- DropForeignKey
43
- ALTER TABLE `contract_installments` DROP FOREIGN KEY `contract_installments_phaseId_fkey`;
44
-
45
- -- DropForeignKey
46
- ALTER TABLE `contract_phase_step_approvals` DROP FOREIGN KEY `contract_phase_step_approvals_approverId_fkey`;
47
-
48
- -- DropForeignKey
49
- ALTER TABLE `contract_phase_step_approvals` DROP FOREIGN KEY `contract_phase_step_approvals_stepId_fkey`;
50
-
51
- -- DropForeignKey
52
- ALTER TABLE `contract_phase_step_documents` DROP FOREIGN KEY `contract_phase_step_documents_stepId_fkey`;
53
-
54
- -- DropForeignKey
55
- ALTER TABLE `contract_phase_steps` DROP FOREIGN KEY `contract_phase_steps_assigneeId_fkey`;
56
-
57
- -- DropForeignKey
58
- ALTER TABLE `contract_phase_steps` DROP FOREIGN KEY `contract_phase_steps_phaseId_fkey`;
59
-
60
- -- DropForeignKey
61
- ALTER TABLE `contract_phases` DROP FOREIGN KEY `contract_phases_currentStepId_fkey`;
62
-
63
- -- DropForeignKey
64
- ALTER TABLE `contract_phases` DROP FOREIGN KEY `contract_phases_paymentPlanId_fkey`;
65
-
66
- -- DropIndex
67
- DROP INDEX `contract_installments_phaseId_idx` ON `contract_installments`;
68
-
69
- -- DropIndex
70
- DROP INDEX `contract_phases_currentStepId_idx` ON `contract_phases`;
71
-
72
- -- DropIndex
73
- DROP INDEX `contract_phases_paymentPlanId_idx` ON `contract_phases`;
74
-
75
- -- DropIndex
76
- DROP INDEX `contracts_state_idx` ON `contracts`;
77
-
78
- -- AlterTable
79
- ALTER TABLE `contract_installments` DROP COLUMN `phaseId`,
80
- ADD COLUMN `paymentPhaseId` VARCHAR(191) NOT NULL;
81
-
82
- -- AlterTable
83
- ALTER TABLE `contract_phases` DROP COLUMN `approvedDocumentsCount`,
84
- DROP COLUMN `collectFunds`,
85
- DROP COLUMN `completedStepsCount`,
86
- DROP COLUMN `completionCriterion`,
87
- DROP COLUMN `currentStepId`,
88
- DROP COLUMN `interestRate`,
89
- DROP COLUMN `minimumCompletionPercentage`,
90
- DROP COLUMN `paidAmount`,
91
- DROP COLUMN `paymentPlanId`,
92
- DROP COLUMN `paymentPlanSnapshot`,
93
- DROP COLUMN `remainingAmount`,
94
- DROP COLUMN `requiredDocumentSnapshot`,
95
- DROP COLUMN `requiredDocumentsCount`,
96
- DROP COLUMN `stepDefinitionsSnapshot`,
97
- DROP COLUMN `totalAmount`,
98
- DROP COLUMN `totalStepsCount`,
99
- MODIFY `phaseCategory` ENUM('QUESTIONNAIRE', 'DOCUMENTATION', 'PAYMENT') NOT NULL,
100
- MODIFY `phaseType` ENUM('PRE_APPROVAL', 'UNDERWRITING', 'KYC', 'VERIFICATION', 'DOWNPAYMENT', 'MORTGAGE', 'BALLOON', 'CUSTOM') NOT NULL;
101
-
102
- -- AlterTable
103
- ALTER TABLE `contracts` DROP COLUMN `debtToIncomeRatio`,
104
- DROP COLUMN `downPayment`,
105
- DROP COLUMN `downPaymentPaid`,
106
- DROP COLUMN `interestRate`,
107
- DROP COLUMN `monthlyExpenses`,
108
- DROP COLUMN `monthlyIncome`,
109
- DROP COLUMN `periodicPayment`,
110
- DROP COLUMN `preApprovalAnswers`,
111
- DROP COLUMN `principal`,
112
- DROP COLUMN `state`,
113
- DROP COLUMN `termMonths`,
114
- DROP COLUMN `totalInterestPaid`,
115
- DROP COLUMN `totalPaidToDate`,
116
- DROP COLUMN `underwritingScore`;
117
-
118
- -- AlterTable
119
- ALTER TABLE `property_payment_method_phases` MODIFY `phaseCategory` ENUM('QUESTIONNAIRE', 'DOCUMENTATION', 'PAYMENT') NOT NULL,
120
- MODIFY `phaseType` ENUM('PRE_APPROVAL', 'UNDERWRITING', 'KYC', 'VERIFICATION', 'DOWNPAYMENT', 'MORTGAGE', 'BALLOON', 'CUSTOM') NOT NULL;
121
-
122
- -- AlterTable
123
- ALTER TABLE `property_transfer_requests` DROP COLUMN `paymentsMigrated`,
124
- ADD COLUMN `refundTransactionId` VARCHAR(191) NULL,
125
- ADD COLUMN `refundedAmount` DOUBLE NULL,
126
- ADD COLUMN `refundedAt` DATETIME(3) NULL;
127
-
128
- -- DropTable
129
- DROP TABLE `contract_phase_step_approvals`;
130
-
131
- -- DropTable
132
- DROP TABLE `contract_phase_step_documents`;
133
-
134
- -- DropTable
135
- DROP TABLE `contract_phase_steps`;
136
-
137
- -- CreateTable
138
- CREATE TABLE `payment_method_phase_fields` (
139
- `id` VARCHAR(191) NOT NULL,
140
- `phaseId` VARCHAR(191) NOT NULL,
141
- `name` VARCHAR(191) NOT NULL,
142
- `label` VARCHAR(191) NOT NULL,
143
- `description` TEXT NULL,
144
- `placeholder` VARCHAR(191) NULL,
145
- `fieldType` ENUM('TEXT', 'TEXTAREA', 'NUMBER', 'CURRENCY', 'EMAIL', 'PHONE', 'DATE', 'SELECT', 'MULTI_SELECT', 'CHECKBOX', 'RADIO', 'FILE') NOT NULL,
146
- `isRequired` BOOLEAN NOT NULL DEFAULT true,
147
- `order` INTEGER NOT NULL,
148
- `validation` JSON NULL,
149
- `displayCondition` JSON NULL,
150
- `defaultValue` JSON NULL,
151
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
152
- `updatedAt` DATETIME(3) NOT NULL,
153
-
154
- INDEX `payment_method_phase_fields_phaseId_idx`(`phaseId`),
155
- UNIQUE INDEX `payment_method_phase_fields_phaseId_name_key`(`phaseId`, `name`),
156
- PRIMARY KEY (`id`)
157
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
158
-
159
- -- CreateTable
160
- CREATE TABLE `questionnaire_phases` (
161
- `id` VARCHAR(191) NOT NULL,
162
- `phaseId` VARCHAR(191) NOT NULL,
163
- `completedFieldsCount` INTEGER NOT NULL DEFAULT 0,
164
- `totalFieldsCount` INTEGER NOT NULL DEFAULT 0,
165
- `underwritingScore` DOUBLE NULL,
166
- `debtToIncomeRatio` DOUBLE NULL,
167
- `underwritingDecision` VARCHAR(191) NULL,
168
- `underwritingNotes` TEXT NULL,
169
- `fieldsSnapshot` JSON NULL,
170
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
171
- `updatedAt` DATETIME(3) NOT NULL,
172
-
173
- UNIQUE INDEX `questionnaire_phases_phaseId_key`(`phaseId`),
174
- INDEX `questionnaire_phases_phaseId_idx`(`phaseId`),
175
- PRIMARY KEY (`id`)
176
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
177
-
178
- -- CreateTable
179
- CREATE TABLE `documentation_phases` (
180
- `id` VARCHAR(191) NOT NULL,
181
- `phaseId` VARCHAR(191) NOT NULL,
182
- `currentStepId` VARCHAR(191) NULL,
183
- `approvedDocumentsCount` INTEGER NOT NULL DEFAULT 0,
184
- `requiredDocumentsCount` INTEGER NOT NULL DEFAULT 0,
185
- `completedStepsCount` INTEGER NOT NULL DEFAULT 0,
186
- `totalStepsCount` INTEGER NOT NULL DEFAULT 0,
187
- `minimumCompletionPercentage` DOUBLE NULL,
188
- `completionCriterion` ENUM('DOCUMENT_APPROVALS', 'PAYMENT_AMOUNT', 'STEPS_COMPLETED') NULL,
189
- `stepDefinitionsSnapshot` JSON NULL,
190
- `requiredDocumentSnapshot` JSON NULL,
191
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
192
- `updatedAt` DATETIME(3) NOT NULL,
193
-
194
- UNIQUE INDEX `documentation_phases_phaseId_key`(`phaseId`),
195
- INDEX `documentation_phases_phaseId_idx`(`phaseId`),
196
- INDEX `documentation_phases_currentStepId_idx`(`currentStepId`),
197
- PRIMARY KEY (`id`)
198
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
199
-
200
- -- CreateTable
201
- CREATE TABLE `payment_phases` (
202
- `id` VARCHAR(191) NOT NULL,
203
- `phaseId` VARCHAR(191) NOT NULL,
204
- `paymentPlanId` VARCHAR(191) NULL,
205
- `totalAmount` DOUBLE NOT NULL,
206
- `paidAmount` DOUBLE NOT NULL DEFAULT 0,
207
- `interestRate` DOUBLE NOT NULL DEFAULT 0,
208
- `collectFunds` BOOLEAN NOT NULL DEFAULT true,
209
- `minimumCompletionPercentage` DOUBLE NULL,
210
- `paymentPlanSnapshot` JSON NULL,
211
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
212
- `updatedAt` DATETIME(3) NOT NULL,
213
-
214
- UNIQUE INDEX `payment_phases_phaseId_key`(`phaseId`),
215
- INDEX `payment_phases_phaseId_idx`(`phaseId`),
216
- INDEX `payment_phases_paymentPlanId_idx`(`paymentPlanId`),
217
- PRIMARY KEY (`id`)
218
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
219
-
220
- -- CreateTable
221
- CREATE TABLE `questionnaire_fields` (
222
- `id` VARCHAR(191) NOT NULL,
223
- `questionnairePhaseId` VARCHAR(191) NOT NULL,
224
- `name` VARCHAR(191) NOT NULL,
225
- `label` VARCHAR(191) NOT NULL,
226
- `description` TEXT NULL,
227
- `placeholder` VARCHAR(191) NULL,
228
- `fieldType` ENUM('TEXT', 'TEXTAREA', 'NUMBER', 'CURRENCY', 'EMAIL', 'PHONE', 'DATE', 'SELECT', 'MULTI_SELECT', 'CHECKBOX', 'RADIO', 'FILE') NOT NULL,
229
- `isRequired` BOOLEAN NOT NULL DEFAULT true,
230
- `order` INTEGER NOT NULL,
231
- `validation` JSON NULL,
232
- `displayCondition` JSON NULL,
233
- `defaultValue` JSON NULL,
234
- `answer` JSON NULL,
235
- `isValid` BOOLEAN NOT NULL DEFAULT false,
236
- `validationErrors` JSON NULL,
237
- `submittedAt` DATETIME(3) NULL,
238
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
239
- `updatedAt` DATETIME(3) NOT NULL,
240
-
241
- INDEX `questionnaire_fields_questionnairePhaseId_idx`(`questionnairePhaseId`),
242
- UNIQUE INDEX `questionnaire_fields_questionnairePhaseId_name_key`(`questionnairePhaseId`, `name`),
243
- PRIMARY KEY (`id`)
244
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
245
-
246
- -- CreateTable
247
- CREATE TABLE `documentation_steps` (
248
- `id` VARCHAR(191) NOT NULL,
249
- `documentationPhaseId` VARCHAR(191) NOT NULL,
250
- `name` VARCHAR(191) NOT NULL,
251
- `description` TEXT NULL,
252
- `stepType` ENUM('UPLOAD', 'REVIEW', 'SIGNATURE', 'APPROVAL', 'EXTERNAL_CHECK', 'WAIT', 'GENERATE_DOCUMENT', 'PRE_APPROVAL', 'UNDERWRITING') NOT NULL,
253
- `order` INTEGER NOT NULL,
254
- `status` ENUM('PENDING', 'IN_PROGRESS', 'COMPLETED', 'FAILED', 'SKIPPED', 'NEEDS_RESUBMISSION', 'ACTION_REQUIRED', 'AWAITING_REVIEW') NOT NULL DEFAULT 'PENDING',
255
- `actionReason` TEXT NULL,
256
- `submissionCount` INTEGER NOT NULL DEFAULT 0,
257
- `lastSubmittedAt` DATETIME(3) NULL,
258
- `metadata` JSON NULL,
259
- `assigneeId` VARCHAR(191) NULL,
260
- `dueDate` DATETIME(3) NULL,
261
- `completedAt` DATETIME(3) NULL,
262
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
263
- `updatedAt` DATETIME(3) NOT NULL,
264
-
265
- INDEX `documentation_steps_documentationPhaseId_idx`(`documentationPhaseId`),
266
- INDEX `documentation_steps_status_idx`(`status`),
267
- INDEX `documentation_steps_order_idx`(`order`),
268
- PRIMARY KEY (`id`)
269
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
270
-
271
- -- CreateTable
272
- CREATE TABLE `documentation_step_documents` (
273
- `id` VARCHAR(191) NOT NULL,
274
- `stepId` VARCHAR(191) NOT NULL,
275
- `documentType` VARCHAR(191) NOT NULL,
276
- `isRequired` BOOLEAN NOT NULL DEFAULT true,
277
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
278
-
279
- INDEX `documentation_step_documents_stepId_documentType_idx`(`stepId`, `documentType`),
280
- PRIMARY KEY (`id`)
281
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
282
-
283
- -- CreateTable
284
- CREATE TABLE `documentation_step_approvals` (
285
- `id` VARCHAR(191) NOT NULL,
286
- `stepId` VARCHAR(191) NOT NULL,
287
- `approverId` VARCHAR(191) NULL,
288
- `decision` ENUM('APPROVED', 'REJECTED', 'REQUEST_CHANGES') NOT NULL,
289
- `comment` TEXT NULL,
290
- `decidedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
291
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
292
-
293
- INDEX `documentation_step_approvals_stepId_idx`(`stepId`),
294
- PRIMARY KEY (`id`)
295
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
296
-
297
- -- CreateIndex
298
- CREATE INDEX `contract_installments_paymentPhaseId_idx` ON `contract_installments`(`paymentPhaseId`);
299
-
300
- -- CreateIndex
301
- CREATE INDEX `contracts_currentPhaseId_idx` ON `contracts`(`currentPhaseId`);
302
-
303
- -- AddForeignKey
304
- ALTER TABLE `payment_method_phase_fields` ADD CONSTRAINT `payment_method_phase_fields_phaseId_fkey` FOREIGN KEY (`phaseId`) REFERENCES `property_payment_method_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
305
-
306
- -- AddForeignKey
307
- ALTER TABLE `contracts` ADD CONSTRAINT `contracts_currentPhaseId_fkey` FOREIGN KEY (`currentPhaseId`) REFERENCES `contract_phases`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
308
-
309
- -- AddForeignKey
310
- ALTER TABLE `questionnaire_phases` ADD CONSTRAINT `questionnaire_phases_phaseId_fkey` FOREIGN KEY (`phaseId`) REFERENCES `contract_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
311
-
312
- -- AddForeignKey
313
- ALTER TABLE `documentation_phases` ADD CONSTRAINT `documentation_phases_phaseId_fkey` FOREIGN KEY (`phaseId`) REFERENCES `contract_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
314
-
315
- -- AddForeignKey
316
- ALTER TABLE `documentation_phases` ADD CONSTRAINT `documentation_phases_currentStepId_fkey` FOREIGN KEY (`currentStepId`) REFERENCES `documentation_steps`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
317
-
318
- -- AddForeignKey
319
- ALTER TABLE `payment_phases` ADD CONSTRAINT `payment_phases_phaseId_fkey` FOREIGN KEY (`phaseId`) REFERENCES `contract_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
320
-
321
- -- AddForeignKey
322
- ALTER TABLE `payment_phases` ADD CONSTRAINT `payment_phases_paymentPlanId_fkey` FOREIGN KEY (`paymentPlanId`) REFERENCES `payment_plans`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
323
-
324
- -- AddForeignKey
325
- ALTER TABLE `questionnaire_fields` ADD CONSTRAINT `questionnaire_fields_questionnairePhaseId_fkey` FOREIGN KEY (`questionnairePhaseId`) REFERENCES `questionnaire_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
326
-
327
- -- AddForeignKey
328
- ALTER TABLE `documentation_steps` ADD CONSTRAINT `documentation_steps_documentationPhaseId_fkey` FOREIGN KEY (`documentationPhaseId`) REFERENCES `documentation_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
329
-
330
- -- AddForeignKey
331
- ALTER TABLE `documentation_steps` ADD CONSTRAINT `documentation_steps_assigneeId_fkey` FOREIGN KEY (`assigneeId`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
332
-
333
- -- AddForeignKey
334
- ALTER TABLE `documentation_step_documents` ADD CONSTRAINT `documentation_step_documents_stepId_fkey` FOREIGN KEY (`stepId`) REFERENCES `documentation_steps`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
335
-
336
- -- AddForeignKey
337
- ALTER TABLE `documentation_step_approvals` ADD CONSTRAINT `documentation_step_approvals_stepId_fkey` FOREIGN KEY (`stepId`) REFERENCES `documentation_steps`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
338
-
339
- -- AddForeignKey
340
- ALTER TABLE `documentation_step_approvals` ADD CONSTRAINT `documentation_step_approvals_approverId_fkey` FOREIGN KEY (`approverId`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
341
-
342
- -- AddForeignKey
343
- ALTER TABLE `contract_installments` ADD CONSTRAINT `contract_installments_paymentPhaseId_fkey` FOREIGN KEY (`paymentPhaseId`) REFERENCES `payment_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
@@ -1,79 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `action` on the `permissions` table. All the data in the column will be lost.
5
- - You are about to drop the column `resource` on the `permissions` table. All the data in the column will be lost.
6
- - A unique constraint covering the columns `[path,tenantId]` on the table `permissions` will be added. If there are existing duplicate values, this will fail.
7
- - A unique constraint covering the columns `[name,tenantId]` on the table `roles` will be added. If there are existing duplicate values, this will fail.
8
- - Added the required column `path` to the `permissions` table without a default value. This is not possible if the table is not empty.
9
-
10
- */
11
- -- DropIndex
12
- DROP INDEX `permissions_name_key` ON `permissions`;
13
-
14
- -- DropIndex
15
- DROP INDEX `permissions_resource_action_key` ON `permissions`;
16
-
17
- -- DropIndex
18
- DROP INDEX `permissions_resource_idx` ON `permissions`;
19
-
20
- -- DropIndex
21
- DROP INDEX `roles_name_key` ON `roles`;
22
-
23
- -- AlterTable
24
- ALTER TABLE `permissions` DROP COLUMN `action`,
25
- DROP COLUMN `resource`,
26
- ADD COLUMN `effect` ENUM('ALLOW', 'DENY') NOT NULL DEFAULT 'ALLOW',
27
- ADD COLUMN `isSystem` BOOLEAN NOT NULL DEFAULT false,
28
- ADD COLUMN `methods` JSON NOT NULL,
29
- ADD COLUMN `path` VARCHAR(191) NOT NULL,
30
- ADD COLUMN `tenantId` VARCHAR(191) NULL;
31
-
32
- -- AlterTable
33
- ALTER TABLE `roles` ADD COLUMN `isActive` BOOLEAN NOT NULL DEFAULT true,
34
- ADD COLUMN `isSystem` BOOLEAN NOT NULL DEFAULT false,
35
- ADD COLUMN `tenantId` VARCHAR(191) NULL;
36
-
37
- -- CreateTable
38
- CREATE TABLE `tenant_memberships` (
39
- `id` VARCHAR(191) NOT NULL,
40
- `userId` VARCHAR(191) NOT NULL,
41
- `tenantId` VARCHAR(191) NOT NULL,
42
- `roleId` VARCHAR(191) NOT NULL,
43
- `isActive` BOOLEAN NOT NULL DEFAULT true,
44
- `isDefault` BOOLEAN NOT NULL DEFAULT false,
45
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
46
- `updatedAt` DATETIME(3) NOT NULL,
47
-
48
- INDEX `tenant_memberships_tenantId_idx`(`tenantId`),
49
- INDEX `tenant_memberships_userId_idx`(`userId`),
50
- UNIQUE INDEX `tenant_memberships_userId_tenantId_key`(`userId`, `tenantId`),
51
- PRIMARY KEY (`id`)
52
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
53
-
54
- -- CreateIndex
55
- CREATE INDEX `permissions_tenantId_idx` ON `permissions`(`tenantId`);
56
-
57
- -- CreateIndex
58
- CREATE UNIQUE INDEX `permissions_path_tenantId_key` ON `permissions`(`path`, `tenantId`);
59
-
60
- -- CreateIndex
61
- CREATE INDEX `roles_tenantId_idx` ON `roles`(`tenantId`);
62
-
63
- -- CreateIndex
64
- CREATE UNIQUE INDEX `roles_name_tenantId_key` ON `roles`(`name`, `tenantId`);
65
-
66
- -- AddForeignKey
67
- ALTER TABLE `roles` ADD CONSTRAINT `roles_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
68
-
69
- -- AddForeignKey
70
- ALTER TABLE `permissions` ADD CONSTRAINT `permissions_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
71
-
72
- -- AddForeignKey
73
- ALTER TABLE `tenant_memberships` ADD CONSTRAINT `tenant_memberships_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
74
-
75
- -- AddForeignKey
76
- ALTER TABLE `tenant_memberships` ADD CONSTRAINT `tenant_memberships_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
77
-
78
- -- AddForeignKey
79
- ALTER TABLE `tenant_memberships` ADD CONSTRAINT `tenant_memberships_roleId_fkey` FOREIGN KEY (`roleId`) REFERENCES `roles`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -1,22 +0,0 @@
1
- -- CreateTable
2
- CREATE TABLE `phase_event_attachments` (
3
- `id` VARCHAR(191) NOT NULL,
4
- `phaseId` VARCHAR(191) NOT NULL,
5
- `trigger` ENUM('ON_ACTIVATE', 'ON_COMPLETE', 'ON_CANCEL', 'ON_PAYMENT_RECEIVED', 'ON_ALL_PAYMENTS_RECEIVED') NOT NULL,
6
- `handlerId` VARCHAR(191) NOT NULL,
7
- `priority` INTEGER NOT NULL DEFAULT 100,
8
- `enabled` BOOLEAN NOT NULL DEFAULT true,
9
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
10
- `updatedAt` DATETIME(3) NOT NULL,
11
-
12
- INDEX `phase_event_attachments_phaseId_idx`(`phaseId`),
13
- INDEX `phase_event_attachments_handlerId_idx`(`handlerId`),
14
- UNIQUE INDEX `phase_event_attachments_phaseId_handlerId_trigger_key`(`phaseId`, `handlerId`, `trigger`),
15
- PRIMARY KEY (`id`)
16
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
17
-
18
- -- AddForeignKey
19
- ALTER TABLE `phase_event_attachments` ADD CONSTRAINT `phase_event_attachments_phaseId_fkey` FOREIGN KEY (`phaseId`) REFERENCES `property_payment_method_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
20
-
21
- -- AddForeignKey
22
- ALTER TABLE `phase_event_attachments` ADD CONSTRAINT `phase_event_attachments_handlerId_fkey` FOREIGN KEY (`handlerId`) REFERENCES `event_handlers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
@@ -1,11 +0,0 @@
1
- -- AlterTable
2
- ALTER TABLE `payment_phases` ADD COLUMN `numberOfInstallments` INTEGER NULL,
3
- ADD COLUMN `selectedTermMonths` INTEGER NULL;
4
-
5
- -- AlterTable
6
- ALTER TABLE `payment_plans` ADD COLUMN `allowFlexibleTerm` BOOLEAN NOT NULL DEFAULT false,
7
- ADD COLUMN `maxAgeAtMaturity` INTEGER NULL,
8
- ADD COLUMN `maxTermMonths` INTEGER NULL,
9
- ADD COLUMN `minTermMonths` INTEGER NULL,
10
- ADD COLUMN `termStepMonths` INTEGER NULL,
11
- MODIFY `numberOfInstallments` INTEGER NULL;