@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,16 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - A unique constraint covering the columns `[tokenHash]` on the table `refresh_tokens` will be added. If there are existing duplicate values, this will fail.
5
- - Added the required column `tokenHash` to the `refresh_tokens` table without a default value. This is not possible if the table is not empty.
6
-
7
- */
8
- -- DropIndex
9
- DROP INDEX `refresh_tokens_token_key` ON `refresh_tokens`;
10
-
11
- -- AlterTable
12
- ALTER TABLE `refresh_tokens` ADD COLUMN `tokenHash` VARCHAR(64) NOT NULL,
13
- MODIFY `token` LONGTEXT NULL;
14
-
15
- -- CreateIndex
16
- CREATE UNIQUE INDEX `refresh_tokens_tokenHash_key` ON `refresh_tokens`(`tokenHash`);
@@ -1,16 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `tokenHash` on the `refresh_tokens` table. All the data in the column will be lost.
5
- - A unique constraint covering the columns `[jti]` on the table `refresh_tokens` will be added. If there are existing duplicate values, this will fail.
6
-
7
- */
8
- -- DropIndex
9
- DROP INDEX `refresh_tokens_tokenHash_key` ON `refresh_tokens`;
10
-
11
- -- AlterTable
12
- ALTER TABLE `refresh_tokens` DROP COLUMN `tokenHash`,
13
- ADD COLUMN `jti` VARCHAR(255) NULL;
14
-
15
- -- CreateIndex
16
- CREATE UNIQUE INDEX `refresh_tokens_jti_key` ON `refresh_tokens`(`jti`);
@@ -1,622 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `paymentPlanId` on the `contracts` table. All the data in the column will be lost.
5
- - You are about to drop the column `propertyId` on the `contracts` table. All the data in the column will be lost.
6
- - You are about to drop the column `buyerId` on the `payment_plans` table. All the data in the column will be lost.
7
- - You are about to drop the column `downPaymentAmount` on the `payment_plans` table. All the data in the column will be lost.
8
- - You are about to drop the column `downPaymentPaid` on the `payment_plans` table. All the data in the column will be lost.
9
- - You are about to drop the column `interestRate` on the `payment_plans` table. All the data in the column will be lost.
10
- - You are about to drop the column `planType` on the `payment_plans` table. All the data in the column will be lost.
11
- - You are about to drop the column `principalAmount` on the `payment_plans` table. All the data in the column will be lost.
12
- - You are about to drop the column `propertyId` on the `payment_plans` table. All the data in the column will be lost.
13
- - You are about to drop the column `state` on the `payment_plans` table. All the data in the column will be lost.
14
- - You are about to drop the column `stateMetadata` on the `payment_plans` table. All the data in the column will be lost.
15
- - You are about to drop the column `totalAmount` on the `payment_plans` table. All the data in the column will be lost.
16
- - You are about to drop the column `totalInterest` on the `payment_plans` table. All the data in the column will be lost.
17
- - You are about to drop the column `area` on the `properties` table. All the data in the column will be lost.
18
- - You are about to drop the column `nBathrooms` on the `properties` table. All the data in the column will be lost.
19
- - You are about to drop the column `nBedrooms` on the `properties` table. All the data in the column will be lost.
20
- - You are about to drop the column `nParkingSpots` on the `properties` table. All the data in the column will be lost.
21
- - You are about to drop the column `price` on the `properties` table. All the data in the column will be lost.
22
- - You are about to drop the `mortgage_documents` table. If the table is not empty, all the data it contains will be lost.
23
- - You are about to drop the `mortgage_downpayment_installments` table. If the table is not empty, all the data it contains will be lost.
24
- - You are about to drop the `mortgage_downpayment_payments` table. If the table is not empty, all the data it contains will be lost.
25
- - You are about to drop the `mortgage_downpayment_plans` table. If the table is not empty, all the data it contains will be lost.
26
- - You are about to drop the `mortgage_steps` table. If the table is not empty, all the data it contains will be lost.
27
- - You are about to drop the `mortgage_transition_events` table. If the table is not empty, all the data it contains will be lost.
28
- - You are about to drop the `mortgage_transitions` table. If the table is not empty, all the data it contains will be lost.
29
- - You are about to drop the `mortgage_types` table. If the table is not empty, all the data it contains will be lost.
30
- - You are about to drop the `mortgages` table. If the table is not empty, all the data it contains will be lost.
31
- - You are about to drop the `payment_installments` table. If the table is not empty, all the data it contains will be lost.
32
- - You are about to drop the `payment_schedules` table. If the table is not empty, all the data it contains will be lost.
33
- - You are about to drop the `payments` table. If the table is not empty, all the data it contains will be lost.
34
- - A unique constraint covering the columns `[name]` on the table `payment_plans` will be added. If there are existing duplicate values, this will fail.
35
- - Added the required column `propertyUnitId` to the `contracts` table without a default value. This is not possible if the table is not empty.
36
- - Added the required column `totalAmount` to the `contracts` table without a default value. This is not possible if the table is not empty.
37
- - Made the column `buyerId` on table `contracts` required. This step will fail if there are existing NULL values in that column.
38
- - Added the required column `numberOfInstallments` to the `payment_plans` table without a default value. This is not possible if the table is not empty.
39
- - Added the required column `paymentFrequency` to the `payment_plans` table without a default value. This is not possible if the table is not empty.
40
-
41
- */
42
- -- DropForeignKey
43
- ALTER TABLE `contracts` DROP FOREIGN KEY `contracts_buyerId_fkey`;
44
-
45
- -- DropForeignKey
46
- ALTER TABLE `contracts` DROP FOREIGN KEY `contracts_paymentPlanId_fkey`;
47
-
48
- -- DropForeignKey
49
- ALTER TABLE `contracts` DROP FOREIGN KEY `contracts_propertyId_fkey`;
50
-
51
- -- DropForeignKey
52
- ALTER TABLE `mortgage_documents` DROP FOREIGN KEY `mortgage_documents_mortgageId_fkey`;
53
-
54
- -- DropForeignKey
55
- ALTER TABLE `mortgage_downpayment_installments` DROP FOREIGN KEY `mortgage_downpayment_installments_planId_fkey`;
56
-
57
- -- DropForeignKey
58
- ALTER TABLE `mortgage_downpayment_payments` DROP FOREIGN KEY `mortgage_downpayment_payments_planId_fkey`;
59
-
60
- -- DropForeignKey
61
- ALTER TABLE `mortgage_steps` DROP FOREIGN KEY `mortgage_steps_mortgageId_fkey`;
62
-
63
- -- DropForeignKey
64
- ALTER TABLE `mortgage_transition_events` DROP FOREIGN KEY `mortgage_transition_events_mortgageId_fkey`;
65
-
66
- -- DropForeignKey
67
- ALTER TABLE `mortgage_transitions` DROP FOREIGN KEY `mortgage_transitions_mortgageId_fkey`;
68
-
69
- -- DropForeignKey
70
- ALTER TABLE `mortgages` DROP FOREIGN KEY `mortgages_borrowerId_fkey`;
71
-
72
- -- DropForeignKey
73
- ALTER TABLE `mortgages` DROP FOREIGN KEY `mortgages_downpaymentPlanId_fkey`;
74
-
75
- -- DropForeignKey
76
- ALTER TABLE `mortgages` DROP FOREIGN KEY `mortgages_mortgageTypeId_fkey`;
77
-
78
- -- DropForeignKey
79
- ALTER TABLE `mortgages` DROP FOREIGN KEY `mortgages_propertyId_fkey`;
80
-
81
- -- DropForeignKey
82
- ALTER TABLE `payment_installments` DROP FOREIGN KEY `payment_installments_scheduleId_fkey`;
83
-
84
- -- DropForeignKey
85
- ALTER TABLE `payment_plans` DROP FOREIGN KEY `payment_plans_buyerId_fkey`;
86
-
87
- -- DropForeignKey
88
- ALTER TABLE `payment_plans` DROP FOREIGN KEY `payment_plans_propertyId_fkey`;
89
-
90
- -- DropForeignKey
91
- ALTER TABLE `payment_schedules` DROP FOREIGN KEY `payment_schedules_planId_fkey`;
92
-
93
- -- DropForeignKey
94
- ALTER TABLE `payments` DROP FOREIGN KEY `payments_installmentId_fkey`;
95
-
96
- -- DropForeignKey
97
- ALTER TABLE `payments` DROP FOREIGN KEY `payments_payerId_fkey`;
98
-
99
- -- DropForeignKey
100
- ALTER TABLE `payments` DROP FOREIGN KEY `payments_planId_fkey`;
101
-
102
- -- DropForeignKey
103
- ALTER TABLE `payments` DROP FOREIGN KEY `payments_scheduleId_fkey`;
104
-
105
- -- DropIndex
106
- DROP INDEX `contracts_paymentPlanId_key` ON `contracts`;
107
-
108
- -- DropIndex
109
- DROP INDEX `contracts_propertyId_idx` ON `contracts`;
110
-
111
- -- DropIndex
112
- DROP INDEX `payment_plans_buyerId_idx` ON `payment_plans`;
113
-
114
- -- DropIndex
115
- DROP INDEX `payment_plans_propertyId_idx` ON `payment_plans`;
116
-
117
- -- DropIndex
118
- DROP INDEX `payment_plans_state_idx` ON `payment_plans`;
119
-
120
- -- AlterTable
121
- ALTER TABLE `amenities` ADD COLUMN `category` VARCHAR(191) NULL,
122
- ADD COLUMN `icon` VARCHAR(191) NULL;
123
-
124
- -- AlterTable
125
- ALTER TABLE `contract_documents` ADD COLUMN `phaseId` VARCHAR(191) NULL,
126
- ADD COLUMN `status` VARCHAR(191) NOT NULL DEFAULT 'PENDING',
127
- ADD COLUMN `stepId` VARCHAR(191) NULL,
128
- ADD COLUMN `uploadedById` VARCHAR(191) NULL;
129
-
130
- -- AlterTable
131
- ALTER TABLE `contracts` DROP COLUMN `paymentPlanId`,
132
- DROP COLUMN `propertyId`,
133
- ADD COLUMN `currentPhaseId` VARCHAR(191) NULL,
134
- ADD COLUMN `downPayment` DOUBLE NOT NULL DEFAULT 0,
135
- ADD COLUMN `downPaymentPaid` DOUBLE NOT NULL DEFAULT 0,
136
- ADD COLUMN `interestRate` DOUBLE NULL,
137
- ADD COLUMN `lastReminderSentAt` DATETIME(3) NULL,
138
- ADD COLUMN `nextPaymentDueDate` DATETIME(3) NULL,
139
- ADD COLUMN `paymentMethodId` VARCHAR(191) NULL,
140
- ADD COLUMN `periodicPayment` DOUBLE NULL,
141
- ADD COLUMN `principal` DOUBLE NULL,
142
- ADD COLUMN `propertyUnitId` VARCHAR(191) NOT NULL,
143
- ADD COLUMN `state` VARCHAR(191) NOT NULL DEFAULT 'DRAFT',
144
- ADD COLUMN `termMonths` INTEGER NULL,
145
- ADD COLUMN `totalAmount` DOUBLE NOT NULL,
146
- ADD COLUMN `totalInterestPaid` DOUBLE NOT NULL DEFAULT 0,
147
- ADD COLUMN `totalPaidToDate` DOUBLE NOT NULL DEFAULT 0,
148
- MODIFY `buyerId` VARCHAR(191) NOT NULL;
149
-
150
- -- AlterTable
151
- ALTER TABLE `payment_plans` DROP COLUMN `buyerId`,
152
- DROP COLUMN `downPaymentAmount`,
153
- DROP COLUMN `downPaymentPaid`,
154
- DROP COLUMN `interestRate`,
155
- DROP COLUMN `planType`,
156
- DROP COLUMN `principalAmount`,
157
- DROP COLUMN `propertyId`,
158
- DROP COLUMN `state`,
159
- DROP COLUMN `stateMetadata`,
160
- DROP COLUMN `totalAmount`,
161
- DROP COLUMN `totalInterest`,
162
- ADD COLUMN `calculateInterestDaily` BOOLEAN NOT NULL DEFAULT false,
163
- ADD COLUMN `customFrequencyDays` INTEGER NULL,
164
- ADD COLUMN `gracePeriodDays` INTEGER NOT NULL DEFAULT 0,
165
- ADD COLUMN `isActive` BOOLEAN NOT NULL DEFAULT true,
166
- ADD COLUMN `numberOfInstallments` INTEGER NOT NULL,
167
- ADD COLUMN `paymentFrequency` VARCHAR(191) NOT NULL;
168
-
169
- -- AlterTable
170
- ALTER TABLE `properties` DROP COLUMN `area`,
171
- DROP COLUMN `nBathrooms`,
172
- DROP COLUMN `nBedrooms`,
173
- DROP COLUMN `nParkingSpots`,
174
- DROP COLUMN `price`;
175
-
176
- -- DropTable
177
- DROP TABLE `mortgage_documents`;
178
-
179
- -- DropTable
180
- DROP TABLE `mortgage_downpayment_installments`;
181
-
182
- -- DropTable
183
- DROP TABLE `mortgage_downpayment_payments`;
184
-
185
- -- DropTable
186
- DROP TABLE `mortgage_downpayment_plans`;
187
-
188
- -- DropTable
189
- DROP TABLE `mortgage_steps`;
190
-
191
- -- DropTable
192
- DROP TABLE `mortgage_transition_events`;
193
-
194
- -- DropTable
195
- DROP TABLE `mortgage_transitions`;
196
-
197
- -- DropTable
198
- DROP TABLE `mortgage_types`;
199
-
200
- -- DropTable
201
- DROP TABLE `mortgages`;
202
-
203
- -- DropTable
204
- DROP TABLE `payment_installments`;
205
-
206
- -- DropTable
207
- DROP TABLE `payment_schedules`;
208
-
209
- -- DropTable
210
- DROP TABLE `payments`;
211
-
212
- -- CreateTable
213
- CREATE TABLE `property_variants` (
214
- `id` VARCHAR(191) NOT NULL,
215
- `propertyId` VARCHAR(191) NOT NULL,
216
- `name` VARCHAR(191) NOT NULL,
217
- `description` TEXT NULL,
218
- `nBedrooms` INTEGER NULL,
219
- `nBathrooms` INTEGER NULL,
220
- `nParkingSpots` INTEGER NULL,
221
- `area` DOUBLE NULL,
222
- `price` DOUBLE NOT NULL,
223
- `pricePerSqm` DOUBLE NULL,
224
- `totalUnits` INTEGER NOT NULL DEFAULT 1,
225
- `availableUnits` INTEGER NOT NULL DEFAULT 1,
226
- `reservedUnits` INTEGER NOT NULL DEFAULT 0,
227
- `soldUnits` INTEGER NOT NULL DEFAULT 0,
228
- `status` VARCHAR(191) NOT NULL DEFAULT 'AVAILABLE',
229
- `isActive` BOOLEAN NOT NULL DEFAULT true,
230
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
231
- `updatedAt` DATETIME(3) NOT NULL,
232
-
233
- INDEX `property_variants_propertyId_idx`(`propertyId`),
234
- INDEX `property_variants_status_idx`(`status`),
235
- INDEX `property_variants_price_idx`(`price`),
236
- PRIMARY KEY (`id`)
237
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
238
-
239
- -- CreateTable
240
- CREATE TABLE `property_variant_amenities` (
241
- `variantId` VARCHAR(191) NOT NULL,
242
- `amenityId` VARCHAR(191) NOT NULL,
243
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
244
-
245
- PRIMARY KEY (`variantId`, `amenityId`)
246
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
247
-
248
- -- CreateTable
249
- CREATE TABLE `property_variant_media` (
250
- `id` VARCHAR(191) NOT NULL,
251
- `variantId` VARCHAR(191) NOT NULL,
252
- `url` VARCHAR(191) NOT NULL,
253
- `type` VARCHAR(191) NOT NULL,
254
- `caption` VARCHAR(191) NULL,
255
- `order` INTEGER NOT NULL DEFAULT 0,
256
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
257
- `updatedAt` DATETIME(3) NOT NULL,
258
-
259
- INDEX `property_variant_media_variantId_idx`(`variantId`),
260
- PRIMARY KEY (`id`)
261
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
262
-
263
- -- CreateTable
264
- CREATE TABLE `property_units` (
265
- `id` VARCHAR(191) NOT NULL,
266
- `variantId` VARCHAR(191) NOT NULL,
267
- `unitNumber` VARCHAR(191) NOT NULL,
268
- `floorNumber` INTEGER NULL,
269
- `blockName` VARCHAR(191) NULL,
270
- `priceOverride` DOUBLE NULL,
271
- `areaOverride` DOUBLE NULL,
272
- `notes` TEXT NULL,
273
- `status` VARCHAR(191) NOT NULL DEFAULT 'AVAILABLE',
274
- `reservedAt` DATETIME(3) NULL,
275
- `reservedUntil` DATETIME(3) NULL,
276
- `reservedById` VARCHAR(191) NULL,
277
- `ownerId` VARCHAR(191) NULL,
278
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
279
- `updatedAt` DATETIME(3) NOT NULL,
280
-
281
- INDEX `property_units_variantId_idx`(`variantId`),
282
- INDEX `property_units_status_idx`(`status`),
283
- UNIQUE INDEX `property_units_variantId_unitNumber_key`(`variantId`, `unitNumber`),
284
- PRIMARY KEY (`id`)
285
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
286
-
287
- -- CreateTable
288
- CREATE TABLE `property_payment_methods` (
289
- `id` VARCHAR(191) NOT NULL,
290
- `name` VARCHAR(191) NOT NULL,
291
- `description` TEXT NULL,
292
- `isActive` BOOLEAN NOT NULL DEFAULT true,
293
- `allowEarlyPayoff` BOOLEAN NOT NULL DEFAULT true,
294
- `earlyPayoffPenaltyRate` DOUBLE NULL,
295
- `autoActivatePhases` BOOLEAN NOT NULL DEFAULT true,
296
- `requiresManualApproval` BOOLEAN NOT NULL DEFAULT false,
297
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
298
- `updatedAt` DATETIME(3) NOT NULL,
299
-
300
- PRIMARY KEY (`id`)
301
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
302
-
303
- -- CreateTable
304
- CREATE TABLE `property_payment_method_links` (
305
- `propertyId` VARCHAR(191) NOT NULL,
306
- `paymentMethodId` VARCHAR(191) NOT NULL,
307
- `isDefault` BOOLEAN NOT NULL DEFAULT false,
308
- `isActive` BOOLEAN NOT NULL DEFAULT true,
309
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
310
-
311
- PRIMARY KEY (`propertyId`, `paymentMethodId`)
312
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
313
-
314
- -- CreateTable
315
- CREATE TABLE `property_payment_method_phases` (
316
- `id` VARCHAR(191) NOT NULL,
317
- `paymentMethodId` VARCHAR(191) NOT NULL,
318
- `paymentPlanId` VARCHAR(191) NULL,
319
- `name` VARCHAR(191) NOT NULL,
320
- `description` TEXT NULL,
321
- `phaseCategory` VARCHAR(191) NOT NULL,
322
- `phaseType` VARCHAR(191) NOT NULL,
323
- `order` INTEGER NOT NULL,
324
- `interestRate` DOUBLE NULL,
325
- `percentOfPrice` DOUBLE NULL,
326
- `requiresPreviousPhaseCompletion` BOOLEAN NOT NULL DEFAULT true,
327
- `minimumCompletionPercentage` DOUBLE NULL,
328
- `requiredDocumentTypes` VARCHAR(191) NULL,
329
- `stepDefinitions` TEXT NULL,
330
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
331
- `updatedAt` DATETIME(3) NOT NULL,
332
-
333
- INDEX `property_payment_method_phases_paymentMethodId_idx`(`paymentMethodId`),
334
- INDEX `property_payment_method_phases_paymentPlanId_idx`(`paymentPlanId`),
335
- INDEX `property_payment_method_phases_phaseCategory_idx`(`phaseCategory`),
336
- PRIMARY KEY (`id`)
337
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
338
-
339
- -- CreateTable
340
- CREATE TABLE `contract_phases` (
341
- `id` VARCHAR(191) NOT NULL,
342
- `contractId` VARCHAR(191) NOT NULL,
343
- `paymentPlanId` VARCHAR(191) NULL,
344
- `name` VARCHAR(191) NOT NULL,
345
- `description` TEXT NULL,
346
- `phaseCategory` VARCHAR(191) NOT NULL,
347
- `phaseType` VARCHAR(191) NOT NULL,
348
- `order` INTEGER NOT NULL,
349
- `status` VARCHAR(191) NOT NULL DEFAULT 'PENDING',
350
- `totalAmount` DOUBLE NULL,
351
- `paidAmount` DOUBLE NOT NULL DEFAULT 0,
352
- `remainingAmount` DOUBLE NULL,
353
- `interestRate` DOUBLE NULL,
354
- `dueDate` DATETIME(3) NULL,
355
- `startDate` DATETIME(3) NULL,
356
- `endDate` DATETIME(3) NULL,
357
- `activatedAt` DATETIME(3) NULL,
358
- `completedAt` DATETIME(3) NULL,
359
- `requiresPreviousPhaseCompletion` BOOLEAN NOT NULL DEFAULT true,
360
- `minimumCompletionPercentage` DOUBLE NULL,
361
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
362
- `updatedAt` DATETIME(3) NOT NULL,
363
-
364
- INDEX `contract_phases_contractId_idx`(`contractId`),
365
- INDEX `contract_phases_paymentPlanId_idx`(`paymentPlanId`),
366
- INDEX `contract_phases_phaseCategory_idx`(`phaseCategory`),
367
- INDEX `contract_phases_status_idx`(`status`),
368
- INDEX `contract_phases_order_idx`(`order`),
369
- PRIMARY KEY (`id`)
370
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
371
-
372
- -- CreateTable
373
- CREATE TABLE `contract_phase_steps` (
374
- `id` VARCHAR(191) NOT NULL,
375
- `phaseId` VARCHAR(191) NOT NULL,
376
- `name` VARCHAR(191) NOT NULL,
377
- `description` TEXT NULL,
378
- `stepType` VARCHAR(191) NOT NULL,
379
- `order` INTEGER NOT NULL,
380
- `status` VARCHAR(191) NOT NULL DEFAULT 'PENDING',
381
- `assigneeId` VARCHAR(191) NULL,
382
- `requiredDocumentTypes` VARCHAR(191) NULL,
383
- `dueDate` DATETIME(3) NULL,
384
- `completedAt` DATETIME(3) NULL,
385
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
386
- `updatedAt` DATETIME(3) NOT NULL,
387
-
388
- INDEX `contract_phase_steps_phaseId_idx`(`phaseId`),
389
- INDEX `contract_phase_steps_status_idx`(`status`),
390
- INDEX `contract_phase_steps_order_idx`(`order`),
391
- PRIMARY KEY (`id`)
392
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
393
-
394
- -- CreateTable
395
- CREATE TABLE `contract_phase_step_approvals` (
396
- `id` VARCHAR(191) NOT NULL,
397
- `stepId` VARCHAR(191) NOT NULL,
398
- `approverId` VARCHAR(191) NULL,
399
- `decision` VARCHAR(191) NOT NULL,
400
- `comment` TEXT NULL,
401
- `decidedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
402
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
403
-
404
- INDEX `contract_phase_step_approvals_stepId_idx`(`stepId`),
405
- PRIMARY KEY (`id`)
406
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
407
-
408
- -- CreateTable
409
- CREATE TABLE `contract_installments` (
410
- `id` VARCHAR(191) NOT NULL,
411
- `phaseId` VARCHAR(191) NOT NULL,
412
- `installmentNumber` INTEGER NOT NULL,
413
- `amount` DOUBLE NOT NULL,
414
- `principalAmount` DOUBLE NOT NULL DEFAULT 0,
415
- `interestAmount` DOUBLE NOT NULL DEFAULT 0,
416
- `dueDate` DATETIME(3) NOT NULL,
417
- `status` VARCHAR(191) NOT NULL DEFAULT 'PENDING',
418
- `paidAmount` DOUBLE NOT NULL DEFAULT 0,
419
- `paidDate` DATETIME(3) NULL,
420
- `lateFee` DOUBLE NOT NULL DEFAULT 0,
421
- `lateFeeWaived` BOOLEAN NOT NULL DEFAULT false,
422
- `gracePeriodDays` INTEGER NOT NULL DEFAULT 0,
423
- `gracePeriodEndDate` DATETIME(3) NULL,
424
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
425
- `updatedAt` DATETIME(3) NOT NULL,
426
-
427
- INDEX `contract_installments_phaseId_idx`(`phaseId`),
428
- INDEX `contract_installments_dueDate_idx`(`dueDate`),
429
- INDEX `contract_installments_status_idx`(`status`),
430
- PRIMARY KEY (`id`)
431
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
432
-
433
- -- CreateTable
434
- CREATE TABLE `contract_payments` (
435
- `id` VARCHAR(191) NOT NULL,
436
- `contractId` VARCHAR(191) NOT NULL,
437
- `phaseId` VARCHAR(191) NULL,
438
- `installmentId` VARCHAR(191) NULL,
439
- `payerId` VARCHAR(191) NULL,
440
- `amount` DOUBLE NOT NULL,
441
- `principalAmount` DOUBLE NOT NULL DEFAULT 0,
442
- `interestAmount` DOUBLE NOT NULL DEFAULT 0,
443
- `lateFeeAmount` DOUBLE NOT NULL DEFAULT 0,
444
- `paymentMethod` VARCHAR(191) NOT NULL,
445
- `status` VARCHAR(191) NOT NULL DEFAULT 'INITIATED',
446
- `reference` VARCHAR(191) NULL,
447
- `gatewayResponse` TEXT NULL,
448
- `processedAt` DATETIME(3) NULL,
449
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
450
- `updatedAt` DATETIME(3) NOT NULL,
451
-
452
- UNIQUE INDEX `contract_payments_reference_key`(`reference`),
453
- INDEX `contract_payments_contractId_idx`(`contractId`),
454
- INDEX `contract_payments_phaseId_idx`(`phaseId`),
455
- INDEX `contract_payments_installmentId_idx`(`installmentId`),
456
- INDEX `contract_payments_payerId_idx`(`payerId`),
457
- INDEX `contract_payments_status_idx`(`status`),
458
- INDEX `contract_payments_reference_idx`(`reference`),
459
- PRIMARY KEY (`id`)
460
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
461
-
462
- -- CreateTable
463
- CREATE TABLE `contract_transitions` (
464
- `id` VARCHAR(191) NOT NULL,
465
- `contractId` VARCHAR(191) NOT NULL,
466
- `fromState` VARCHAR(191) NOT NULL,
467
- `toState` VARCHAR(191) NOT NULL,
468
- `trigger` VARCHAR(191) NOT NULL,
469
- `metadata` TEXT NULL,
470
- `transitionedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
471
-
472
- INDEX `contract_transitions_contractId_idx`(`contractId`),
473
- PRIMARY KEY (`id`)
474
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
475
-
476
- -- CreateTable
477
- CREATE TABLE `contract_events` (
478
- `id` VARCHAR(191) NOT NULL,
479
- `contractId` VARCHAR(191) NOT NULL,
480
- `event` VARCHAR(191) NOT NULL,
481
- `data` TEXT NULL,
482
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
483
-
484
- INDEX `contract_events_contractId_idx`(`contractId`),
485
- PRIMARY KEY (`id`)
486
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
487
-
488
- -- CreateTable
489
- CREATE TABLE `domain_events` (
490
- `id` VARCHAR(191) NOT NULL,
491
- `eventType` VARCHAR(191) NOT NULL,
492
- `aggregateType` VARCHAR(191) NOT NULL,
493
- `aggregateId` VARCHAR(191) NOT NULL,
494
- `queueName` VARCHAR(191) NOT NULL,
495
- `payload` TEXT NOT NULL,
496
- `occurredAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
497
- `actorId` VARCHAR(191) NULL,
498
- `actorRole` VARCHAR(191) NULL,
499
- `status` VARCHAR(191) NOT NULL DEFAULT 'PENDING',
500
- `processedAt` DATETIME(3) NULL,
501
- `sentAt` DATETIME(3) NULL,
502
- `failureCount` INTEGER NOT NULL DEFAULT 0,
503
- `lastError` TEXT NULL,
504
- `nextRetryAt` DATETIME(3) NULL,
505
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
506
- `updatedAt` DATETIME(3) NOT NULL,
507
-
508
- INDEX `domain_events_status_nextRetryAt_idx`(`status`, `nextRetryAt`),
509
- INDEX `domain_events_eventType_idx`(`eventType`),
510
- INDEX `domain_events_aggregateType_aggregateId_idx`(`aggregateType`, `aggregateId`),
511
- INDEX `domain_events_queueName_idx`(`queueName`),
512
- INDEX `domain_events_occurredAt_idx`(`occurredAt`),
513
- PRIMARY KEY (`id`)
514
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
515
-
516
- -- CreateIndex
517
- CREATE INDEX `amenities_category_idx` ON `amenities`(`category`);
518
-
519
- -- CreateIndex
520
- CREATE INDEX `contract_documents_phaseId_idx` ON `contract_documents`(`phaseId`);
521
-
522
- -- CreateIndex
523
- CREATE INDEX `contract_documents_stepId_idx` ON `contract_documents`(`stepId`);
524
-
525
- -- CreateIndex
526
- CREATE INDEX `contract_documents_type_idx` ON `contract_documents`(`type`);
527
-
528
- -- CreateIndex
529
- CREATE INDEX `contract_documents_status_idx` ON `contract_documents`(`status`);
530
-
531
- -- CreateIndex
532
- CREATE INDEX `contracts_propertyUnitId_idx` ON `contracts`(`propertyUnitId`);
533
-
534
- -- CreateIndex
535
- CREATE INDEX `contracts_paymentMethodId_idx` ON `contracts`(`paymentMethodId`);
536
-
537
- -- CreateIndex
538
- CREATE INDEX `contracts_state_idx` ON `contracts`(`state`);
539
-
540
- -- CreateIndex
541
- CREATE UNIQUE INDEX `payment_plans_name_key` ON `payment_plans`(`name`);
542
-
543
- -- CreateIndex
544
- CREATE INDEX `properties_status_idx` ON `properties`(`status`);
545
-
546
- -- AddForeignKey
547
- ALTER TABLE `property_variants` ADD CONSTRAINT `property_variants_propertyId_fkey` FOREIGN KEY (`propertyId`) REFERENCES `properties`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
548
-
549
- -- AddForeignKey
550
- ALTER TABLE `property_variant_amenities` ADD CONSTRAINT `property_variant_amenities_variantId_fkey` FOREIGN KEY (`variantId`) REFERENCES `property_variants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
551
-
552
- -- AddForeignKey
553
- ALTER TABLE `property_variant_amenities` ADD CONSTRAINT `property_variant_amenities_amenityId_fkey` FOREIGN KEY (`amenityId`) REFERENCES `amenities`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
554
-
555
- -- AddForeignKey
556
- ALTER TABLE `property_variant_media` ADD CONSTRAINT `property_variant_media_variantId_fkey` FOREIGN KEY (`variantId`) REFERENCES `property_variants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
557
-
558
- -- AddForeignKey
559
- ALTER TABLE `property_units` ADD CONSTRAINT `property_units_variantId_fkey` FOREIGN KEY (`variantId`) REFERENCES `property_variants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
560
-
561
- -- AddForeignKey
562
- ALTER TABLE `property_payment_method_links` ADD CONSTRAINT `property_payment_method_links_propertyId_fkey` FOREIGN KEY (`propertyId`) REFERENCES `properties`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
563
-
564
- -- AddForeignKey
565
- ALTER TABLE `property_payment_method_links` ADD CONSTRAINT `property_payment_method_links_paymentMethodId_fkey` FOREIGN KEY (`paymentMethodId`) REFERENCES `property_payment_methods`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
566
-
567
- -- AddForeignKey
568
- ALTER TABLE `property_payment_method_phases` ADD CONSTRAINT `property_payment_method_phases_paymentMethodId_fkey` FOREIGN KEY (`paymentMethodId`) REFERENCES `property_payment_methods`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
569
-
570
- -- AddForeignKey
571
- ALTER TABLE `property_payment_method_phases` ADD CONSTRAINT `property_payment_method_phases_paymentPlanId_fkey` FOREIGN KEY (`paymentPlanId`) REFERENCES `payment_plans`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
572
-
573
- -- AddForeignKey
574
- ALTER TABLE `contracts` ADD CONSTRAINT `contracts_propertyUnitId_fkey` FOREIGN KEY (`propertyUnitId`) REFERENCES `property_units`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
575
-
576
- -- AddForeignKey
577
- ALTER TABLE `contracts` ADD CONSTRAINT `contracts_buyerId_fkey` FOREIGN KEY (`buyerId`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
578
-
579
- -- AddForeignKey
580
- ALTER TABLE `contracts` ADD CONSTRAINT `contracts_paymentMethodId_fkey` FOREIGN KEY (`paymentMethodId`) REFERENCES `property_payment_methods`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
581
-
582
- -- AddForeignKey
583
- ALTER TABLE `contract_phases` ADD CONSTRAINT `contract_phases_contractId_fkey` FOREIGN KEY (`contractId`) REFERENCES `contracts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
584
-
585
- -- AddForeignKey
586
- ALTER TABLE `contract_phases` ADD CONSTRAINT `contract_phases_paymentPlanId_fkey` FOREIGN KEY (`paymentPlanId`) REFERENCES `payment_plans`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
587
-
588
- -- AddForeignKey
589
- ALTER TABLE `contract_phase_steps` ADD CONSTRAINT `contract_phase_steps_phaseId_fkey` FOREIGN KEY (`phaseId`) REFERENCES `contract_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
590
-
591
- -- AddForeignKey
592
- ALTER TABLE `contract_phase_steps` ADD CONSTRAINT `contract_phase_steps_assigneeId_fkey` FOREIGN KEY (`assigneeId`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
593
-
594
- -- AddForeignKey
595
- ALTER TABLE `contract_phase_step_approvals` ADD CONSTRAINT `contract_phase_step_approvals_stepId_fkey` FOREIGN KEY (`stepId`) REFERENCES `contract_phase_steps`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
596
-
597
- -- AddForeignKey
598
- ALTER TABLE `contract_phase_step_approvals` ADD CONSTRAINT `contract_phase_step_approvals_approverId_fkey` FOREIGN KEY (`approverId`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
599
-
600
- -- AddForeignKey
601
- ALTER TABLE `contract_installments` ADD CONSTRAINT `contract_installments_phaseId_fkey` FOREIGN KEY (`phaseId`) REFERENCES `contract_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
602
-
603
- -- AddForeignKey
604
- ALTER TABLE `contract_payments` ADD CONSTRAINT `contract_payments_contractId_fkey` FOREIGN KEY (`contractId`) REFERENCES `contracts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
605
-
606
- -- AddForeignKey
607
- ALTER TABLE `contract_payments` ADD CONSTRAINT `contract_payments_phaseId_fkey` FOREIGN KEY (`phaseId`) REFERENCES `contract_phases`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
608
-
609
- -- AddForeignKey
610
- ALTER TABLE `contract_payments` ADD CONSTRAINT `contract_payments_installmentId_fkey` FOREIGN KEY (`installmentId`) REFERENCES `contract_installments`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
611
-
612
- -- AddForeignKey
613
- ALTER TABLE `contract_payments` ADD CONSTRAINT `contract_payments_payerId_fkey` FOREIGN KEY (`payerId`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
614
-
615
- -- AddForeignKey
616
- ALTER TABLE `contract_documents` ADD CONSTRAINT `contract_documents_uploadedById_fkey` FOREIGN KEY (`uploadedById`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
617
-
618
- -- AddForeignKey
619
- ALTER TABLE `contract_transitions` ADD CONSTRAINT `contract_transitions_contractId_fkey` FOREIGN KEY (`contractId`) REFERENCES `contracts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
620
-
621
- -- AddForeignKey
622
- ALTER TABLE `contract_events` ADD CONSTRAINT `contract_events_contractId_fkey` FOREIGN KEY (`contractId`) REFERENCES `contracts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;