@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.
- package/dist/generated/client/browser.d.ts +1 -1
- package/dist/generated/client/client.d.ts +1 -1
- package/dist/generated/client/internal/class.js +2 -2
- package/dist/generated/client/internal/prismaNamespace.d.ts +2 -4
- package/dist/generated/client/internal/prismaNamespace.js +2 -4
- package/dist/generated/client/internal/prismaNamespaceBrowser.d.ts +2 -4
- package/dist/generated/client/internal/prismaNamespaceBrowser.js +2 -4
- package/dist/generated/client/models/BankDocumentRequirement.d.ts +90 -154
- package/dist/generated/client/models/PropertyPaymentMethod.d.ts +3 -192
- package/dist/generated/client/models/PropertyPaymentMethodPhase.d.ts +227 -4
- package/package.json +1 -1
- package/prisma/migrations/0_init/migration.sql +2327 -0
- package/prisma/schema.prisma +17 -18
- package/prisma/migrations/20251228081517_create_initial_tables/migration.sql +0 -707
- package/prisma/migrations/20251228083337_refresh_token_hash/migration.sql +0 -16
- package/prisma/migrations/20251228084551/migration.sql +0 -16
- package/prisma/migrations/20251230104059_add_property_variants/migration.sql +0 -622
- package/prisma/migrations/20251230113413_add_multitenancy/migration.sql +0 -54
- package/prisma/migrations/20251230231217_add_prequalification_and_payment_method_change/migration.sql +0 -137
- package/prisma/migrations/20260101081428_normalize_schema/migration.sql +0 -119
- package/prisma/migrations/20260101102022_add_contract_termination/migration.sql +0 -69
- package/prisma/migrations/20260101110958_add_collect_funds/migration.sql +0 -8
- package/prisma/migrations/20260104084843_add_document_templates_and_offer_letters/migration.sql +0 -77
- package/prisma/migrations/20260104095131_add_underwriting_decision/migration.sql +0 -31
- package/prisma/migrations/20260104170149_add_generate_document_step_type/migration.sql +0 -5
- package/prisma/migrations/20260104172349_add_metadata_to_contract_phase_step/migration.sql +0 -2
- package/prisma/migrations/20260104174626_make_offer_letter_template_optional/migration.sql +0 -11
- package/prisma/migrations/20260105004059_add_superseded_phase_status/migration.sql +0 -2
- package/prisma/migrations/20260105074701_add_underwriting_step_types/migration.sql +0 -17
- package/prisma/migrations/20260105080236_remove_prequalification_model/migration.sql +0 -37
- package/prisma/migrations/20260105081842_unify_contract_events/migration.sql +0 -37
- package/prisma/migrations/20260105085337_simplify_los_remove_prequalification/migration.sql +0 -1
- package/prisma/migrations/20260105094604_workflow_tracking_current_step/migration.sql +0 -14
- package/prisma/migrations/20260105130633_add_api_keys/migration.sql +0 -26
- package/prisma/migrations/20260105151535_add_event_workflow_system/migration.sql +0 -132
- package/prisma/migrations/20260105160757_add_sns_handler_type/migration.sql +0 -2
- package/prisma/migrations/20260106003757_business_friendly_handler_types/migration.sql +0 -28
- package/prisma/migrations/20260106062140_add_step_event_attachments/migration.sql +0 -22
- package/prisma/migrations/20260107121844_add_property_transfer_requests/migration.sql +0 -64
- package/prisma/migrations/20260107172301_add_approval_request_model/migration.sql +0 -46
- package/prisma/migrations/20260107214834_add_contract_refund_model/migration.sql +0 -64
- package/prisma/migrations/20260108051928_add_approval_request_type_status_index/migration.sql +0 -2
- package/prisma/migrations/20260109132751_update_transfer_flow/migration.sql +0 -343
- package/prisma/migrations/20260111091027_rbac_redesign_federated_users/migration.sql +0 -79
- package/prisma/migrations/20260112000006_add_phase_event_attachments/migration.sql +0 -22
- package/prisma/migrations/20260112041159_add_flexible_term_configuration/migration.sql +0 -11
- package/prisma/migrations/20260112080730_rename_contract_to_application/migration.sql +0 -293
- package/prisma/migrations/20260112081422_cleanup_rename_contract_to_application/migration.sql +0 -14
- package/prisma/migrations/20260113000000_remove_workflow_analytics_summary/migration.sql +0 -5
- package/prisma/migrations/20260113110450_add_tenant_id_to_child_models/migration.sql +0 -334
- package/prisma/migrations/20260113122855_add_tenant_to_remaining_models/migration.sql +0 -64
- package/prisma/migrations/20260114034523_add_documentation_plan/migration.sql +0 -52
- package/prisma/migrations/20260114053042_add_questionnaire_plan/migration.sql +0 -73
- package/prisma/migrations/20260114164044_add_condition_to_documentation_plan_step/migration.sql +0 -10
- package/prisma/migrations/20260115055636_add_unit_locking/migration.sql +0 -16
- package/prisma/migrations/20260115060132_add_phase_template_reference/migration.sql +0 -8
- package/prisma/migrations/20260115084033_add_gate_step_type/migration.sql +0 -29
- package/prisma/migrations/20260115123703_add_organizations/migration.sql +0 -69
- package/prisma/migrations/20260115125519_add_requires_manual_review_to_step/migration.sql +0 -2
- package/prisma/migrations/20260115134106_add_conditional_step_support/migration.sql +0 -11
- package/prisma/migrations/20260116090633_add_question_category_enum/migration.sql +0 -8
- package/prisma/migrations/20260116152051_add_multi_party_document_review/migration.sql +0 -59
- package/prisma/migrations/20260116153745_add_platform_organization_type/migration.sql +0 -3
- package/prisma/migrations/20260119180401_add_document_name_remove_required_doc_types/migration.sql +0 -14
- package/prisma/migrations/20260119190336_add_document_approval_workflow/migration.sql +0 -134
- package/prisma/migrations/20260120024650_add_questionnaire_phase_review/migration.sql +0 -102
- package/prisma/migrations/20260121155057_add_event_execution_and_bank_docs/migration.sql +0 -198
- package/prisma/migrations/20260121161937_add_phase_step_order_unique_constraints/migration.sql +0 -12
- package/prisma/migrations/20260121163910_add_optimistic_locking/migration.sql +0 -14
- package/prisma/migrations/20260125090213_remove_is_published_use_status_enum/migration.sql +0 -10
- package/prisma/migrations/20260125102448_org_types_many_to_many/migration.sql +0 -153
- package/prisma/migrations/20260125103700_20260125102448_org_types_many_to_many_fix/migration.sql +0 -5
- package/prisma/migrations/20260126031132_add_organization_id_to_property/migration.sql +0 -8
- package/prisma/migrations/migration_lock.toml +0 -3
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Warnings:
|
|
3
|
-
|
|
4
|
-
- A unique constraint covering the columns `[tenantId,name]` on the table `payment_plans` will be added. If there are existing duplicate values, this will fail.
|
|
5
|
-
- A unique constraint covering the columns `[tenantId,name]` on the table `property_payment_methods` will be added. If there are existing duplicate values, this will fail.
|
|
6
|
-
- Added the required column `tenantId` to the `contracts` table without a default value. This is not possible if the table is not empty.
|
|
7
|
-
- Added the required column `tenantId` to the `properties` table without a default value. This is not possible if the table is not empty.
|
|
8
|
-
- Added the required column `tenantId` to the `property_payment_methods` table without a default value. This is not possible if the table is not empty.
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
-- DropIndex
|
|
12
|
-
DROP INDEX `payment_plans_name_key` ON `payment_plans`;
|
|
13
|
-
|
|
14
|
-
-- AlterTable
|
|
15
|
-
ALTER TABLE `contracts` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
16
|
-
|
|
17
|
-
-- AlterTable
|
|
18
|
-
ALTER TABLE `payment_plans` ADD COLUMN `tenantId` VARCHAR(191) NULL;
|
|
19
|
-
|
|
20
|
-
-- AlterTable
|
|
21
|
-
ALTER TABLE `properties` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
22
|
-
|
|
23
|
-
-- AlterTable
|
|
24
|
-
ALTER TABLE `property_payment_methods` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
25
|
-
|
|
26
|
-
-- CreateIndex
|
|
27
|
-
CREATE INDEX `contracts_tenantId_idx` ON `contracts`(`tenantId`);
|
|
28
|
-
|
|
29
|
-
-- CreateIndex
|
|
30
|
-
CREATE INDEX `payment_plans_tenantId_idx` ON `payment_plans`(`tenantId`);
|
|
31
|
-
|
|
32
|
-
-- CreateIndex
|
|
33
|
-
CREATE UNIQUE INDEX `payment_plans_tenantId_name_key` ON `payment_plans`(`tenantId`, `name`);
|
|
34
|
-
|
|
35
|
-
-- CreateIndex
|
|
36
|
-
CREATE INDEX `properties_tenantId_idx` ON `properties`(`tenantId`);
|
|
37
|
-
|
|
38
|
-
-- CreateIndex
|
|
39
|
-
CREATE INDEX `property_payment_methods_tenantId_idx` ON `property_payment_methods`(`tenantId`);
|
|
40
|
-
|
|
41
|
-
-- CreateIndex
|
|
42
|
-
CREATE UNIQUE INDEX `property_payment_methods_tenantId_name_key` ON `property_payment_methods`(`tenantId`, `name`);
|
|
43
|
-
|
|
44
|
-
-- AddForeignKey
|
|
45
|
-
ALTER TABLE `properties` ADD CONSTRAINT `properties_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
46
|
-
|
|
47
|
-
-- AddForeignKey
|
|
48
|
-
ALTER TABLE `payment_plans` ADD CONSTRAINT `payment_plans_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
49
|
-
|
|
50
|
-
-- AddForeignKey
|
|
51
|
-
ALTER TABLE `property_payment_methods` ADD CONSTRAINT `property_payment_methods_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
52
|
-
|
|
53
|
-
-- AddForeignKey
|
|
54
|
-
ALTER TABLE `contracts` ADD CONSTRAINT `contracts_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE `prequalifications` (
|
|
3
|
-
`id` VARCHAR(191) NOT NULL,
|
|
4
|
-
`tenantId` VARCHAR(191) NOT NULL,
|
|
5
|
-
`userId` VARCHAR(191) NOT NULL,
|
|
6
|
-
`propertyId` VARCHAR(191) NOT NULL,
|
|
7
|
-
`paymentMethodId` VARCHAR(191) NOT NULL,
|
|
8
|
-
`answers` JSON NOT NULL,
|
|
9
|
-
`score` DOUBLE NULL,
|
|
10
|
-
`requestedAmount` DOUBLE NULL,
|
|
11
|
-
`monthlyIncome` DOUBLE NULL,
|
|
12
|
-
`monthlyExpenses` DOUBLE NULL,
|
|
13
|
-
`debtToIncomeRatio` DOUBLE NULL,
|
|
14
|
-
`suggestedTermMonths` INTEGER NULL,
|
|
15
|
-
`status` ENUM('DRAFT', 'SUBMITTED', 'UNDER_REVIEW', 'APPROVED', 'REJECTED', 'EXPIRED') NOT NULL DEFAULT 'DRAFT',
|
|
16
|
-
`notes` TEXT NULL,
|
|
17
|
-
`reviewedBy` VARCHAR(191) NULL,
|
|
18
|
-
`reviewedAt` DATETIME(3) NULL,
|
|
19
|
-
`expiresAt` DATETIME(3) NULL,
|
|
20
|
-
`contractId` VARCHAR(191) NULL,
|
|
21
|
-
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
22
|
-
`updatedAt` DATETIME(3) NOT NULL,
|
|
23
|
-
|
|
24
|
-
UNIQUE INDEX `prequalifications_contractId_key`(`contractId`),
|
|
25
|
-
INDEX `prequalifications_tenantId_idx`(`tenantId`),
|
|
26
|
-
INDEX `prequalifications_userId_idx`(`userId`),
|
|
27
|
-
INDEX `prequalifications_propertyId_idx`(`propertyId`),
|
|
28
|
-
INDEX `prequalifications_status_idx`(`status`),
|
|
29
|
-
PRIMARY KEY (`id`)
|
|
30
|
-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
31
|
-
|
|
32
|
-
-- CreateTable
|
|
33
|
-
CREATE TABLE `payment_method_change_requests` (
|
|
34
|
-
`id` VARCHAR(191) NOT NULL,
|
|
35
|
-
`tenantId` VARCHAR(191) NOT NULL,
|
|
36
|
-
`contractId` VARCHAR(191) NOT NULL,
|
|
37
|
-
`fromPaymentMethodId` VARCHAR(191) NOT NULL,
|
|
38
|
-
`toPaymentMethodId` VARCHAR(191) NOT NULL,
|
|
39
|
-
`requestorId` VARCHAR(191) NOT NULL,
|
|
40
|
-
`reason` TEXT NULL,
|
|
41
|
-
`requiredDocumentTypes` VARCHAR(191) NULL,
|
|
42
|
-
`submittedDocuments` JSON NULL,
|
|
43
|
-
`currentOutstanding` DOUBLE NULL,
|
|
44
|
-
`newTermMonths` INTEGER NULL,
|
|
45
|
-
`newInterestRate` DOUBLE NULL,
|
|
46
|
-
`newMonthlyPayment` DOUBLE NULL,
|
|
47
|
-
`penaltyAmount` DOUBLE NULL,
|
|
48
|
-
`financialImpactNotes` TEXT NULL,
|
|
49
|
-
`status` ENUM('PENDING_DOCUMENTS', 'DOCUMENTS_SUBMITTED', 'UNDER_REVIEW', 'APPROVED', 'REJECTED', 'EXECUTED', 'CANCELLED') NOT NULL DEFAULT 'PENDING_DOCUMENTS',
|
|
50
|
-
`reviewerId` VARCHAR(191) NULL,
|
|
51
|
-
`reviewNotes` TEXT NULL,
|
|
52
|
-
`reviewedAt` DATETIME(3) NULL,
|
|
53
|
-
`executedAt` DATETIME(3) NULL,
|
|
54
|
-
`previousPhaseData` JSON NULL,
|
|
55
|
-
`newPhaseData` JSON NULL,
|
|
56
|
-
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
57
|
-
`updatedAt` DATETIME(3) NOT NULL,
|
|
58
|
-
|
|
59
|
-
INDEX `payment_method_change_requests_tenantId_idx`(`tenantId`),
|
|
60
|
-
INDEX `payment_method_change_requests_contractId_idx`(`contractId`),
|
|
61
|
-
INDEX `payment_method_change_requests_status_idx`(`status`),
|
|
62
|
-
INDEX `payment_method_change_requests_requestorId_idx`(`requestorId`),
|
|
63
|
-
PRIMARY KEY (`id`)
|
|
64
|
-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
65
|
-
|
|
66
|
-
-- CreateTable
|
|
67
|
-
CREATE TABLE `document_requirement_rules` (
|
|
68
|
-
`id` VARCHAR(191) NOT NULL,
|
|
69
|
-
`tenantId` VARCHAR(191) NOT NULL,
|
|
70
|
-
`context` ENUM('PREQUALIFICATION', 'CONTRACT_PHASE', 'PAYMENT_METHOD_CHANGE') NOT NULL,
|
|
71
|
-
`paymentMethodId` VARCHAR(191) NULL,
|
|
72
|
-
`phaseType` VARCHAR(191) NULL,
|
|
73
|
-
`fromPaymentMethodId` VARCHAR(191) NULL,
|
|
74
|
-
`toPaymentMethodId` VARCHAR(191) NULL,
|
|
75
|
-
`documentType` VARCHAR(191) NOT NULL,
|
|
76
|
-
`isRequired` BOOLEAN NOT NULL DEFAULT true,
|
|
77
|
-
`description` VARCHAR(191) NULL,
|
|
78
|
-
`maxSizeBytes` INTEGER NULL,
|
|
79
|
-
`allowedMimeTypes` VARCHAR(191) NULL,
|
|
80
|
-
`expiryDays` INTEGER NULL,
|
|
81
|
-
`requiresManualReview` BOOLEAN NOT NULL DEFAULT false,
|
|
82
|
-
`isActive` BOOLEAN NOT NULL DEFAULT true,
|
|
83
|
-
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
84
|
-
`updatedAt` DATETIME(3) NOT NULL,
|
|
85
|
-
|
|
86
|
-
INDEX `document_requirement_rules_tenantId_idx`(`tenantId`),
|
|
87
|
-
INDEX `document_requirement_rules_context_idx`(`context`),
|
|
88
|
-
INDEX `document_requirement_rules_paymentMethodId_idx`(`paymentMethodId`),
|
|
89
|
-
INDEX `document_requirement_rules_phaseType_idx`(`phaseType`),
|
|
90
|
-
INDEX `document_requirement_rules_fromPaymentMethodId_toPaymentMeth_idx`(`fromPaymentMethodId`, `toPaymentMethodId`),
|
|
91
|
-
PRIMARY KEY (`id`)
|
|
92
|
-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
93
|
-
|
|
94
|
-
-- AddForeignKey
|
|
95
|
-
ALTER TABLE `prequalifications` ADD CONSTRAINT `prequalifications_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
96
|
-
|
|
97
|
-
-- AddForeignKey
|
|
98
|
-
ALTER TABLE `prequalifications` ADD CONSTRAINT `prequalifications_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
99
|
-
|
|
100
|
-
-- AddForeignKey
|
|
101
|
-
ALTER TABLE `prequalifications` ADD CONSTRAINT `prequalifications_propertyId_fkey` FOREIGN KEY (`propertyId`) REFERENCES `properties`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
102
|
-
|
|
103
|
-
-- AddForeignKey
|
|
104
|
-
ALTER TABLE `prequalifications` ADD CONSTRAINT `prequalifications_paymentMethodId_fkey` FOREIGN KEY (`paymentMethodId`) REFERENCES `property_payment_methods`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
105
|
-
|
|
106
|
-
-- AddForeignKey
|
|
107
|
-
ALTER TABLE `prequalifications` ADD CONSTRAINT `prequalifications_contractId_fkey` FOREIGN KEY (`contractId`) REFERENCES `contracts`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
108
|
-
|
|
109
|
-
-- AddForeignKey
|
|
110
|
-
ALTER TABLE `payment_method_change_requests` ADD CONSTRAINT `payment_method_change_requests_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
111
|
-
|
|
112
|
-
-- AddForeignKey
|
|
113
|
-
ALTER TABLE `payment_method_change_requests` ADD CONSTRAINT `payment_method_change_requests_contractId_fkey` FOREIGN KEY (`contractId`) REFERENCES `contracts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
114
|
-
|
|
115
|
-
-- AddForeignKey
|
|
116
|
-
ALTER TABLE `payment_method_change_requests` ADD CONSTRAINT `payment_method_change_requests_fromPaymentMethodId_fkey` FOREIGN KEY (`fromPaymentMethodId`) REFERENCES `property_payment_methods`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
117
|
-
|
|
118
|
-
-- AddForeignKey
|
|
119
|
-
ALTER TABLE `payment_method_change_requests` ADD CONSTRAINT `payment_method_change_requests_toPaymentMethodId_fkey` FOREIGN KEY (`toPaymentMethodId`) REFERENCES `property_payment_methods`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
120
|
-
|
|
121
|
-
-- AddForeignKey
|
|
122
|
-
ALTER TABLE `payment_method_change_requests` ADD CONSTRAINT `payment_method_change_requests_requestorId_fkey` FOREIGN KEY (`requestorId`) REFERENCES `users`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
123
|
-
|
|
124
|
-
-- AddForeignKey
|
|
125
|
-
ALTER TABLE `payment_method_change_requests` ADD CONSTRAINT `payment_method_change_requests_reviewerId_fkey` FOREIGN KEY (`reviewerId`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
126
|
-
|
|
127
|
-
-- AddForeignKey
|
|
128
|
-
ALTER TABLE `document_requirement_rules` ADD CONSTRAINT `document_requirement_rules_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
129
|
-
|
|
130
|
-
-- AddForeignKey
|
|
131
|
-
ALTER TABLE `document_requirement_rules` ADD CONSTRAINT `document_requirement_rules_paymentMethodId_fkey` FOREIGN KEY (`paymentMethodId`) REFERENCES `property_payment_methods`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
132
|
-
|
|
133
|
-
-- AddForeignKey
|
|
134
|
-
ALTER TABLE `document_requirement_rules` ADD CONSTRAINT `document_requirement_rules_fromPaymentMethodId_fkey` FOREIGN KEY (`fromPaymentMethodId`) REFERENCES `property_payment_methods`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
135
|
-
|
|
136
|
-
-- AddForeignKey
|
|
137
|
-
ALTER TABLE `document_requirement_rules` ADD CONSTRAINT `document_requirement_rules_toPaymentMethodId_fkey` FOREIGN KEY (`toPaymentMethodId`) REFERENCES `property_payment_methods`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Warnings:
|
|
3
|
-
|
|
4
|
-
- You are about to alter the column `status` on the `contract_documents` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(16))`.
|
|
5
|
-
- You are about to alter the column `status` on the `contract_installments` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(14))`.
|
|
6
|
-
- You are about to alter the column `status` on the `contract_payments` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(15))`.
|
|
7
|
-
- You are about to alter the column `decision` on the `contract_phase_step_approvals` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(13))`.
|
|
8
|
-
- You are about to drop the column `requiredDocumentTypes` on the `contract_phase_steps` table. All the data in the column will be lost.
|
|
9
|
-
- You are about to alter the column `stepType` on the `contract_phase_steps` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(11))`.
|
|
10
|
-
- You are about to alter the column `status` on the `contract_phase_steps` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(12))`.
|
|
11
|
-
- You are about to alter the column `phaseCategory` on the `contract_phases` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(7))`.
|
|
12
|
-
- You are about to alter the column `phaseType` on the `contract_phases` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(8))`.
|
|
13
|
-
- You are about to alter the column `status` on the `contract_phases` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(9))`.
|
|
14
|
-
- You are about to alter the column `status` on the `contracts` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(6))`.
|
|
15
|
-
- You are about to alter the column `state` on the `contracts` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(6))`.
|
|
16
|
-
- You are about to alter the column `paymentFrequency` on the `payment_plans` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(0))`.
|
|
17
|
-
- You are about to drop the column `requiredDocumentTypes` on the `property_payment_method_phases` table. All the data in the column will be lost.
|
|
18
|
-
- You are about to drop the column `stepDefinitions` on the `property_payment_method_phases` table. All the data in the column will be lost.
|
|
19
|
-
- You are about to alter the column `phaseCategory` on the `property_payment_method_phases` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(7))`.
|
|
20
|
-
- You are about to alter the column `phaseType` on the `property_payment_method_phases` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(8))`.
|
|
21
|
-
|
|
22
|
-
*/
|
|
23
|
-
-- AlterTable
|
|
24
|
-
ALTER TABLE `contract_documents` MODIFY `status` ENUM('PENDING', 'APPROVED', 'REJECTED') NOT NULL DEFAULT 'PENDING';
|
|
25
|
-
|
|
26
|
-
-- AlterTable
|
|
27
|
-
ALTER TABLE `contract_installments` MODIFY `status` ENUM('PENDING', 'PAID', 'OVERDUE', 'PARTIALLY_PAID', 'WAIVED') NOT NULL DEFAULT 'PENDING';
|
|
28
|
-
|
|
29
|
-
-- AlterTable
|
|
30
|
-
ALTER TABLE `contract_payments` MODIFY `status` ENUM('INITIATED', 'PENDING', 'COMPLETED', 'FAILED', 'REFUNDED') NOT NULL DEFAULT 'INITIATED';
|
|
31
|
-
|
|
32
|
-
-- AlterTable
|
|
33
|
-
ALTER TABLE `contract_phase_step_approvals` MODIFY `decision` ENUM('APPROVED', 'REJECTED', 'REQUEST_CHANGES') NOT NULL;
|
|
34
|
-
|
|
35
|
-
-- AlterTable
|
|
36
|
-
ALTER TABLE `contract_phase_steps` DROP COLUMN `requiredDocumentTypes`,
|
|
37
|
-
MODIFY `stepType` ENUM('UPLOAD', 'REVIEW', 'SIGNATURE', 'APPROVAL', 'EXTERNAL_CHECK', 'WAIT') NOT NULL,
|
|
38
|
-
MODIFY `status` ENUM('PENDING', 'IN_PROGRESS', 'COMPLETED', 'FAILED', 'SKIPPED') NOT NULL DEFAULT 'PENDING';
|
|
39
|
-
|
|
40
|
-
-- AlterTable
|
|
41
|
-
ALTER TABLE `contract_phases` ADD COLUMN `approvedDocumentsCount` INTEGER NOT NULL DEFAULT 0,
|
|
42
|
-
ADD COLUMN `completedStepsCount` INTEGER NOT NULL DEFAULT 0,
|
|
43
|
-
ADD COLUMN `completionCriterion` ENUM('DOCUMENT_APPROVALS', 'PAYMENT_AMOUNT', 'STEPS_COMPLETED') NULL,
|
|
44
|
-
ADD COLUMN `paymentPlanSnapshot` JSON NULL,
|
|
45
|
-
ADD COLUMN `requiredDocumentSnapshot` JSON NULL,
|
|
46
|
-
ADD COLUMN `requiredDocumentsCount` INTEGER NOT NULL DEFAULT 0,
|
|
47
|
-
ADD COLUMN `stepDefinitionsSnapshot` JSON NULL,
|
|
48
|
-
ADD COLUMN `totalStepsCount` INTEGER NOT NULL DEFAULT 0,
|
|
49
|
-
MODIFY `phaseCategory` ENUM('DOCUMENTATION', 'PAYMENT') NOT NULL,
|
|
50
|
-
MODIFY `phaseType` ENUM('KYC', 'VERIFICATION', 'DOWNPAYMENT', 'MORTGAGE', 'BALLOON', 'CUSTOM') NOT NULL,
|
|
51
|
-
MODIFY `status` ENUM('PENDING', 'IN_PROGRESS', 'AWAITING_APPROVAL', 'ACTIVE', 'COMPLETED', 'SKIPPED', 'FAILED') NOT NULL DEFAULT 'PENDING';
|
|
52
|
-
|
|
53
|
-
-- AlterTable
|
|
54
|
-
ALTER TABLE `contracts` MODIFY `status` ENUM('DRAFT', 'PENDING', 'ACTIVE', 'COMPLETED', 'CANCELLED', 'TERMINATED') NOT NULL DEFAULT 'DRAFT',
|
|
55
|
-
MODIFY `state` ENUM('DRAFT', 'PENDING', 'ACTIVE', 'COMPLETED', 'CANCELLED', 'TERMINATED') NOT NULL DEFAULT 'DRAFT';
|
|
56
|
-
|
|
57
|
-
-- AlterTable
|
|
58
|
-
ALTER TABLE `payment_plans` MODIFY `paymentFrequency` ENUM('MONTHLY', 'BIWEEKLY', 'WEEKLY', 'ONE_TIME', 'CUSTOM') NOT NULL;
|
|
59
|
-
|
|
60
|
-
-- AlterTable
|
|
61
|
-
ALTER TABLE `property_payment_method_phases` DROP COLUMN `requiredDocumentTypes`,
|
|
62
|
-
DROP COLUMN `stepDefinitions`,
|
|
63
|
-
ADD COLUMN `completionCriterion` ENUM('DOCUMENT_APPROVALS', 'PAYMENT_AMOUNT', 'STEPS_COMPLETED') NULL,
|
|
64
|
-
ADD COLUMN `requiredDocumentSnapshot` JSON NULL,
|
|
65
|
-
ADD COLUMN `stepDefinitionsSnapshot` JSON NULL,
|
|
66
|
-
MODIFY `phaseCategory` ENUM('DOCUMENTATION', 'PAYMENT') NOT NULL,
|
|
67
|
-
MODIFY `phaseType` ENUM('KYC', 'VERIFICATION', 'DOWNPAYMENT', 'MORTGAGE', 'BALLOON', 'CUSTOM') NOT NULL;
|
|
68
|
-
|
|
69
|
-
-- CreateTable
|
|
70
|
-
CREATE TABLE `payment_method_phase_steps` (
|
|
71
|
-
`id` VARCHAR(191) NOT NULL,
|
|
72
|
-
`phaseId` VARCHAR(191) NOT NULL,
|
|
73
|
-
`name` VARCHAR(191) NOT NULL,
|
|
74
|
-
`stepType` ENUM('UPLOAD', 'REVIEW', 'SIGNATURE', 'APPROVAL', 'EXTERNAL_CHECK', 'WAIT') NOT NULL,
|
|
75
|
-
`order` INTEGER NOT NULL,
|
|
76
|
-
`metadata` JSON NULL,
|
|
77
|
-
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
78
|
-
`updatedAt` DATETIME(3) NOT NULL,
|
|
79
|
-
|
|
80
|
-
INDEX `payment_method_phase_steps_phaseId_idx`(`phaseId`),
|
|
81
|
-
PRIMARY KEY (`id`)
|
|
82
|
-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
83
|
-
|
|
84
|
-
-- CreateTable
|
|
85
|
-
CREATE TABLE `payment_method_phase_documents` (
|
|
86
|
-
`id` VARCHAR(191) NOT NULL,
|
|
87
|
-
`phaseId` VARCHAR(191) NOT NULL,
|
|
88
|
-
`documentType` VARCHAR(191) NOT NULL,
|
|
89
|
-
`isRequired` BOOLEAN NOT NULL DEFAULT true,
|
|
90
|
-
`description` TEXT NULL,
|
|
91
|
-
`allowedMimeTypes` VARCHAR(191) NULL,
|
|
92
|
-
`maxSizeBytes` INTEGER NULL,
|
|
93
|
-
`metadata` JSON NULL,
|
|
94
|
-
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
95
|
-
|
|
96
|
-
INDEX `payment_method_phase_documents_phaseId_documentType_idx`(`phaseId`, `documentType`),
|
|
97
|
-
PRIMARY KEY (`id`)
|
|
98
|
-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
99
|
-
|
|
100
|
-
-- CreateTable
|
|
101
|
-
CREATE TABLE `contract_phase_step_documents` (
|
|
102
|
-
`id` VARCHAR(191) NOT NULL,
|
|
103
|
-
`stepId` VARCHAR(191) NOT NULL,
|
|
104
|
-
`documentType` VARCHAR(191) NOT NULL,
|
|
105
|
-
`isRequired` BOOLEAN NOT NULL DEFAULT true,
|
|
106
|
-
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
107
|
-
|
|
108
|
-
INDEX `contract_phase_step_documents_stepId_documentType_idx`(`stepId`, `documentType`),
|
|
109
|
-
PRIMARY KEY (`id`)
|
|
110
|
-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
111
|
-
|
|
112
|
-
-- AddForeignKey
|
|
113
|
-
ALTER TABLE `payment_method_phase_steps` ADD CONSTRAINT `payment_method_phase_steps_phaseId_fkey` FOREIGN KEY (`phaseId`) REFERENCES `property_payment_method_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
114
|
-
|
|
115
|
-
-- AddForeignKey
|
|
116
|
-
ALTER TABLE `payment_method_phase_documents` ADD CONSTRAINT `payment_method_phase_documents_phaseId_fkey` FOREIGN KEY (`phaseId`) REFERENCES `property_payment_method_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
117
|
-
|
|
118
|
-
-- AddForeignKey
|
|
119
|
-
ALTER TABLE `contract_phase_step_documents` ADD CONSTRAINT `contract_phase_step_documents_stepId_fkey` FOREIGN KEY (`stepId`) REFERENCES `contract_phase_steps`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE `contract_terminations` (
|
|
3
|
-
`id` VARCHAR(191) NOT NULL,
|
|
4
|
-
`contractId` VARCHAR(191) NOT NULL,
|
|
5
|
-
`tenantId` VARCHAR(191) NOT NULL,
|
|
6
|
-
`requestNumber` VARCHAR(191) NOT NULL,
|
|
7
|
-
`initiatedBy` ENUM('BUYER', 'SELLER', 'ADMIN', 'SYSTEM') NOT NULL,
|
|
8
|
-
`initiatorId` VARCHAR(191) NULL,
|
|
9
|
-
`type` ENUM('BUYER_WITHDRAWAL', 'SELLER_WITHDRAWAL', 'MUTUAL_AGREEMENT', 'PAYMENT_DEFAULT', 'DOCUMENT_FAILURE', 'FRAUD', 'FORCE_MAJEURE', 'PROPERTY_UNAVAILABLE', 'REGULATORY', 'OTHER') NOT NULL,
|
|
10
|
-
`reason` TEXT NULL,
|
|
11
|
-
`supportingDocs` JSON NULL,
|
|
12
|
-
`status` ENUM('REQUESTED', 'PENDING_REVIEW', 'PENDING_REFUND', 'REFUND_IN_PROGRESS', 'REFUND_COMPLETED', 'COMPLETED', 'REJECTED', 'CANCELLED') NOT NULL DEFAULT 'REQUESTED',
|
|
13
|
-
`requiresApproval` BOOLEAN NOT NULL DEFAULT true,
|
|
14
|
-
`autoApproveEligible` BOOLEAN NOT NULL DEFAULT false,
|
|
15
|
-
`reviewedBy` VARCHAR(191) NULL,
|
|
16
|
-
`reviewedAt` DATETIME(3) NULL,
|
|
17
|
-
`reviewNotes` TEXT NULL,
|
|
18
|
-
`rejectionReason` TEXT NULL,
|
|
19
|
-
`contractSnapshot` JSON NOT NULL,
|
|
20
|
-
`totalContractAmount` DOUBLE NOT NULL,
|
|
21
|
-
`totalPaidToDate` DOUBLE NOT NULL,
|
|
22
|
-
`outstandingBalance` DOUBLE NOT NULL,
|
|
23
|
-
`refundableAmount` DOUBLE NOT NULL DEFAULT 0,
|
|
24
|
-
`penaltyAmount` DOUBLE NOT NULL DEFAULT 0,
|
|
25
|
-
`forfeitedAmount` DOUBLE NOT NULL DEFAULT 0,
|
|
26
|
-
`adminFeeAmount` DOUBLE NOT NULL DEFAULT 0,
|
|
27
|
-
`netRefundAmount` DOUBLE NOT NULL DEFAULT 0,
|
|
28
|
-
`settlementNotes` TEXT NULL,
|
|
29
|
-
`refundStatus` ENUM('NOT_APPLICABLE', 'PENDING', 'INITIATED', 'PROCESSING', 'PARTIAL_COMPLETED', 'COMPLETED', 'FAILED') NOT NULL DEFAULT 'NOT_APPLICABLE',
|
|
30
|
-
`refundReference` VARCHAR(191) NULL,
|
|
31
|
-
`refundMethod` VARCHAR(191) NULL,
|
|
32
|
-
`refundAccountDetails` JSON NULL,
|
|
33
|
-
`refundInitiatedAt` DATETIME(3) NULL,
|
|
34
|
-
`refundCompletedAt` DATETIME(3) NULL,
|
|
35
|
-
`refundFailureReason` TEXT NULL,
|
|
36
|
-
`unitReleasedAt` DATETIME(3) NULL,
|
|
37
|
-
`unitReservedForId` VARCHAR(191) NULL,
|
|
38
|
-
`requestedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
39
|
-
`approvedAt` DATETIME(3) NULL,
|
|
40
|
-
`executedAt` DATETIME(3) NULL,
|
|
41
|
-
`completedAt` DATETIME(3) NULL,
|
|
42
|
-
`cancelledAt` DATETIME(3) NULL,
|
|
43
|
-
`idempotencyKey` VARCHAR(191) NULL,
|
|
44
|
-
`metadata` JSON NULL,
|
|
45
|
-
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
46
|
-
`updatedAt` DATETIME(3) NOT NULL,
|
|
47
|
-
|
|
48
|
-
UNIQUE INDEX `contract_terminations_requestNumber_key`(`requestNumber`),
|
|
49
|
-
UNIQUE INDEX `contract_terminations_idempotencyKey_key`(`idempotencyKey`),
|
|
50
|
-
INDEX `contract_terminations_contractId_idx`(`contractId`),
|
|
51
|
-
INDEX `contract_terminations_tenantId_idx`(`tenantId`),
|
|
52
|
-
INDEX `contract_terminations_status_idx`(`status`),
|
|
53
|
-
INDEX `contract_terminations_type_idx`(`type`),
|
|
54
|
-
INDEX `contract_terminations_initiatorId_idx`(`initiatorId`),
|
|
55
|
-
INDEX `contract_terminations_requestedAt_idx`(`requestedAt`),
|
|
56
|
-
PRIMARY KEY (`id`)
|
|
57
|
-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
58
|
-
|
|
59
|
-
-- AddForeignKey
|
|
60
|
-
ALTER TABLE `contract_terminations` ADD CONSTRAINT `contract_terminations_contractId_fkey` FOREIGN KEY (`contractId`) REFERENCES `contracts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
61
|
-
|
|
62
|
-
-- AddForeignKey
|
|
63
|
-
ALTER TABLE `contract_terminations` ADD CONSTRAINT `contract_terminations_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
64
|
-
|
|
65
|
-
-- AddForeignKey
|
|
66
|
-
ALTER TABLE `contract_terminations` ADD CONSTRAINT `contract_terminations_initiatorId_fkey` FOREIGN KEY (`initiatorId`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
67
|
-
|
|
68
|
-
-- AddForeignKey
|
|
69
|
-
ALTER TABLE `contract_terminations` ADD CONSTRAINT `contract_terminations_reviewedBy_fkey` FOREIGN KEY (`reviewedBy`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
-- AlterTable
|
|
2
|
-
ALTER TABLE `contract_phases` ADD COLUMN `collectFunds` BOOLEAN NOT NULL DEFAULT true;
|
|
3
|
-
|
|
4
|
-
-- AlterTable
|
|
5
|
-
ALTER TABLE `payment_plans` ADD COLUMN `collectFunds` BOOLEAN NOT NULL DEFAULT true;
|
|
6
|
-
|
|
7
|
-
-- AlterTable
|
|
8
|
-
ALTER TABLE `property_payment_method_phases` ADD COLUMN `collectFunds` BOOLEAN NULL;
|
package/prisma/migrations/20260104084843_add_document_templates_and_offer_letters/migration.sql
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
-- AlterTable
|
|
2
|
-
ALTER TABLE `contract_documents` MODIFY `status` ENUM('DRAFT', 'PENDING', 'PENDING_SIGNATURE', 'SENT', 'VIEWED', 'SIGNED', 'APPROVED', 'REJECTED', 'EXPIRED', 'CANCELLED') NOT NULL DEFAULT 'PENDING';
|
|
3
|
-
|
|
4
|
-
-- CreateTable
|
|
5
|
-
CREATE TABLE `document_templates` (
|
|
6
|
-
`id` VARCHAR(191) NOT NULL,
|
|
7
|
-
`tenantId` VARCHAR(191) NOT NULL,
|
|
8
|
-
`name` VARCHAR(191) NOT NULL,
|
|
9
|
-
`code` VARCHAR(191) NOT NULL,
|
|
10
|
-
`description` VARCHAR(191) NULL,
|
|
11
|
-
`version` INTEGER NOT NULL DEFAULT 1,
|
|
12
|
-
`htmlTemplate` TEXT NOT NULL,
|
|
13
|
-
`cssStyles` TEXT NULL,
|
|
14
|
-
`mergeFields` JSON NULL,
|
|
15
|
-
`isActive` BOOLEAN NOT NULL DEFAULT true,
|
|
16
|
-
`isDefault` BOOLEAN NOT NULL DEFAULT false,
|
|
17
|
-
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
18
|
-
`updatedAt` DATETIME(3) NOT NULL,
|
|
19
|
-
|
|
20
|
-
INDEX `document_templates_tenantId_idx`(`tenantId`),
|
|
21
|
-
INDEX `document_templates_code_idx`(`code`),
|
|
22
|
-
UNIQUE INDEX `document_templates_tenantId_code_version_key`(`tenantId`, `code`, `version`),
|
|
23
|
-
PRIMARY KEY (`id`)
|
|
24
|
-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
25
|
-
|
|
26
|
-
-- CreateTable
|
|
27
|
-
CREATE TABLE `offer_letters` (
|
|
28
|
-
`id` VARCHAR(191) NOT NULL,
|
|
29
|
-
`tenantId` VARCHAR(191) NOT NULL,
|
|
30
|
-
`contractId` VARCHAR(191) NOT NULL,
|
|
31
|
-
`templateId` VARCHAR(191) NOT NULL,
|
|
32
|
-
`letterNumber` VARCHAR(191) NOT NULL,
|
|
33
|
-
`type` ENUM('PROVISIONAL', 'FINAL') NOT NULL,
|
|
34
|
-
`status` ENUM('DRAFT', 'GENERATED', 'SENT', 'VIEWED', 'SIGNED', 'EXPIRED', 'CANCELLED') NOT NULL DEFAULT 'DRAFT',
|
|
35
|
-
`htmlContent` TEXT NULL,
|
|
36
|
-
`pdfUrl` VARCHAR(191) NULL,
|
|
37
|
-
`pdfKey` VARCHAR(191) NULL,
|
|
38
|
-
`mergeData` JSON NULL,
|
|
39
|
-
`sentAt` DATETIME(3) NULL,
|
|
40
|
-
`viewedAt` DATETIME(3) NULL,
|
|
41
|
-
`signedAt` DATETIME(3) NULL,
|
|
42
|
-
`signatureIp` VARCHAR(191) NULL,
|
|
43
|
-
`signatureData` JSON NULL,
|
|
44
|
-
`expiresAt` DATETIME(3) NULL,
|
|
45
|
-
`expiredAt` DATETIME(3) NULL,
|
|
46
|
-
`cancelledAt` DATETIME(3) NULL,
|
|
47
|
-
`cancelReason` VARCHAR(191) NULL,
|
|
48
|
-
`generatedById` VARCHAR(191) NULL,
|
|
49
|
-
`sentById` VARCHAR(191) NULL,
|
|
50
|
-
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
51
|
-
`updatedAt` DATETIME(3) NOT NULL,
|
|
52
|
-
|
|
53
|
-
UNIQUE INDEX `offer_letters_letterNumber_key`(`letterNumber`),
|
|
54
|
-
INDEX `offer_letters_tenantId_idx`(`tenantId`),
|
|
55
|
-
INDEX `offer_letters_contractId_idx`(`contractId`),
|
|
56
|
-
INDEX `offer_letters_type_idx`(`type`),
|
|
57
|
-
INDEX `offer_letters_status_idx`(`status`),
|
|
58
|
-
PRIMARY KEY (`id`)
|
|
59
|
-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
60
|
-
|
|
61
|
-
-- AddForeignKey
|
|
62
|
-
ALTER TABLE `document_templates` ADD CONSTRAINT `document_templates_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
63
|
-
|
|
64
|
-
-- AddForeignKey
|
|
65
|
-
ALTER TABLE `offer_letters` ADD CONSTRAINT `offer_letters_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
66
|
-
|
|
67
|
-
-- AddForeignKey
|
|
68
|
-
ALTER TABLE `offer_letters` ADD CONSTRAINT `offer_letters_contractId_fkey` FOREIGN KEY (`contractId`) REFERENCES `contracts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
69
|
-
|
|
70
|
-
-- AddForeignKey
|
|
71
|
-
ALTER TABLE `offer_letters` ADD CONSTRAINT `offer_letters_templateId_fkey` FOREIGN KEY (`templateId`) REFERENCES `document_templates`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
72
|
-
|
|
73
|
-
-- AddForeignKey
|
|
74
|
-
ALTER TABLE `offer_letters` ADD CONSTRAINT `offer_letters_generatedById_fkey` FOREIGN KEY (`generatedById`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
75
|
-
|
|
76
|
-
-- AddForeignKey
|
|
77
|
-
ALTER TABLE `offer_letters` ADD CONSTRAINT `offer_letters_sentById_fkey` FOREIGN KEY (`sentById`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE `underwriting_decisions` (
|
|
3
|
-
`id` VARCHAR(191) NOT NULL,
|
|
4
|
-
`tenantId` VARCHAR(191) NOT NULL,
|
|
5
|
-
`prequalificationId` VARCHAR(191) NOT NULL,
|
|
6
|
-
`decision` ENUM('APPROVE', 'REJECT', 'CONDITIONAL') NOT NULL,
|
|
7
|
-
`score` DOUBLE NULL,
|
|
8
|
-
`reasons` JSON NULL,
|
|
9
|
-
`conditions` JSON NULL,
|
|
10
|
-
`rulesVersion` VARCHAR(191) NULL,
|
|
11
|
-
`ruleResults` JSON NULL,
|
|
12
|
-
`externalChecks` JSON NULL,
|
|
13
|
-
`isManualReview` BOOLEAN NOT NULL DEFAULT false,
|
|
14
|
-
`reviewedBy` VARCHAR(191) NULL,
|
|
15
|
-
`reviewedAt` DATETIME(3) NULL,
|
|
16
|
-
`reviewNotes` TEXT NULL,
|
|
17
|
-
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
18
|
-
`updatedAt` DATETIME(3) NOT NULL,
|
|
19
|
-
|
|
20
|
-
INDEX `underwriting_decisions_tenantId_idx`(`tenantId`),
|
|
21
|
-
INDEX `underwriting_decisions_prequalificationId_idx`(`prequalificationId`),
|
|
22
|
-
INDEX `underwriting_decisions_decision_idx`(`decision`),
|
|
23
|
-
INDEX `underwriting_decisions_createdAt_idx`(`createdAt`),
|
|
24
|
-
PRIMARY KEY (`id`)
|
|
25
|
-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
26
|
-
|
|
27
|
-
-- AddForeignKey
|
|
28
|
-
ALTER TABLE `underwriting_decisions` ADD CONSTRAINT `underwriting_decisions_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
29
|
-
|
|
30
|
-
-- AddForeignKey
|
|
31
|
-
ALTER TABLE `underwriting_decisions` ADD CONSTRAINT `underwriting_decisions_prequalificationId_fkey` FOREIGN KEY (`prequalificationId`) REFERENCES `prequalifications`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
-- AlterTable
|
|
2
|
-
ALTER TABLE `contract_phase_steps` MODIFY `stepType` ENUM('UPLOAD', 'REVIEW', 'SIGNATURE', 'APPROVAL', 'EXTERNAL_CHECK', 'WAIT', 'GENERATE_DOCUMENT') NOT NULL;
|
|
3
|
-
|
|
4
|
-
-- AlterTable
|
|
5
|
-
ALTER TABLE `payment_method_phase_steps` MODIFY `stepType` ENUM('UPLOAD', 'REVIEW', 'SIGNATURE', 'APPROVAL', 'EXTERNAL_CHECK', 'WAIT', 'GENERATE_DOCUMENT') NOT NULL;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
-- DropForeignKey
|
|
2
|
-
ALTER TABLE `offer_letters` DROP FOREIGN KEY `offer_letters_templateId_fkey`;
|
|
3
|
-
|
|
4
|
-
-- DropIndex
|
|
5
|
-
DROP INDEX `offer_letters_templateId_fkey` ON `offer_letters`;
|
|
6
|
-
|
|
7
|
-
-- AlterTable
|
|
8
|
-
ALTER TABLE `offer_letters` MODIFY `templateId` VARCHAR(191) NULL;
|
|
9
|
-
|
|
10
|
-
-- AddForeignKey
|
|
11
|
-
ALTER TABLE `offer_letters` ADD CONSTRAINT `offer_letters_templateId_fkey` FOREIGN KEY (`templateId`) REFERENCES `document_templates`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
-- AlterTable
|
|
2
|
-
ALTER TABLE `contract_phase_steps` ADD COLUMN `debtToIncomeRatio` DOUBLE NULL,
|
|
3
|
-
ADD COLUMN `preApprovalAnswers` JSON NULL,
|
|
4
|
-
ADD COLUMN `underwritingDecision` VARCHAR(191) NULL,
|
|
5
|
-
ADD COLUMN `underwritingNotes` TEXT NULL,
|
|
6
|
-
ADD COLUMN `underwritingScore` DOUBLE NULL,
|
|
7
|
-
MODIFY `stepType` ENUM('UPLOAD', 'REVIEW', 'SIGNATURE', 'APPROVAL', 'EXTERNAL_CHECK', 'WAIT', 'GENERATE_DOCUMENT', 'PRE_APPROVAL', 'UNDERWRITING') NOT NULL;
|
|
8
|
-
|
|
9
|
-
-- AlterTable
|
|
10
|
-
ALTER TABLE `contracts` ADD COLUMN `debtToIncomeRatio` DOUBLE NULL,
|
|
11
|
-
ADD COLUMN `monthlyExpenses` DOUBLE NULL,
|
|
12
|
-
ADD COLUMN `monthlyIncome` DOUBLE NULL,
|
|
13
|
-
ADD COLUMN `preApprovalAnswers` JSON NULL,
|
|
14
|
-
ADD COLUMN `underwritingScore` DOUBLE NULL;
|
|
15
|
-
|
|
16
|
-
-- AlterTable
|
|
17
|
-
ALTER TABLE `payment_method_phase_steps` MODIFY `stepType` ENUM('UPLOAD', 'REVIEW', 'SIGNATURE', 'APPROVAL', 'EXTERNAL_CHECK', 'WAIT', 'GENERATE_DOCUMENT', 'PRE_APPROVAL', 'UNDERWRITING') NOT NULL;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Warnings:
|
|
3
|
-
|
|
4
|
-
- The values [PREQUALIFICATION] on the enum `document_requirement_rules_context` will be removed. If these variants are still used in the database, this will fail.
|
|
5
|
-
- You are about to drop the `prequalifications` table. If the table is not empty, all the data it contains will be lost.
|
|
6
|
-
- You are about to drop the `underwriting_decisions` table. If the table is not empty, all the data it contains will be lost.
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
-- DropForeignKey
|
|
10
|
-
ALTER TABLE `prequalifications` DROP FOREIGN KEY `prequalifications_contractId_fkey`;
|
|
11
|
-
|
|
12
|
-
-- DropForeignKey
|
|
13
|
-
ALTER TABLE `prequalifications` DROP FOREIGN KEY `prequalifications_paymentMethodId_fkey`;
|
|
14
|
-
|
|
15
|
-
-- DropForeignKey
|
|
16
|
-
ALTER TABLE `prequalifications` DROP FOREIGN KEY `prequalifications_propertyId_fkey`;
|
|
17
|
-
|
|
18
|
-
-- DropForeignKey
|
|
19
|
-
ALTER TABLE `prequalifications` DROP FOREIGN KEY `prequalifications_tenantId_fkey`;
|
|
20
|
-
|
|
21
|
-
-- DropForeignKey
|
|
22
|
-
ALTER TABLE `prequalifications` DROP FOREIGN KEY `prequalifications_userId_fkey`;
|
|
23
|
-
|
|
24
|
-
-- DropForeignKey
|
|
25
|
-
ALTER TABLE `underwriting_decisions` DROP FOREIGN KEY `underwriting_decisions_prequalificationId_fkey`;
|
|
26
|
-
|
|
27
|
-
-- DropForeignKey
|
|
28
|
-
ALTER TABLE `underwriting_decisions` DROP FOREIGN KEY `underwriting_decisions_tenantId_fkey`;
|
|
29
|
-
|
|
30
|
-
-- AlterTable
|
|
31
|
-
ALTER TABLE `document_requirement_rules` MODIFY `context` ENUM('CONTRACT_PHASE', 'PAYMENT_METHOD_CHANGE') NOT NULL;
|
|
32
|
-
|
|
33
|
-
-- DropTable
|
|
34
|
-
DROP TABLE `prequalifications`;
|
|
35
|
-
|
|
36
|
-
-- DropTable
|
|
37
|
-
DROP TABLE `underwriting_decisions`;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Warnings:
|
|
3
|
-
|
|
4
|
-
- You are about to drop the column `createdAt` on the `contract_events` table. All the data in the column will be lost.
|
|
5
|
-
- You are about to drop the column `event` on the `contract_events` table. All the data in the column will be lost.
|
|
6
|
-
- You are about to alter the column `data` on the `contract_events` table. The data in that column could be lost. The data in that column will be cast from `Text` to `Json`.
|
|
7
|
-
- You are about to drop the `contract_transitions` table. If the table is not empty, all the data it contains will be lost.
|
|
8
|
-
- Added the required column `eventType` to the `contract_events` table without a default value. This is not possible if the table is not empty.
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
-- DropForeignKey
|
|
12
|
-
ALTER TABLE `contract_transitions` DROP FOREIGN KEY `contract_transitions_contractId_fkey`;
|
|
13
|
-
|
|
14
|
-
-- AlterTable
|
|
15
|
-
ALTER TABLE `contract_events` DROP COLUMN `createdAt`,
|
|
16
|
-
DROP COLUMN `event`,
|
|
17
|
-
ADD COLUMN `actorId` VARCHAR(191) NULL,
|
|
18
|
-
ADD COLUMN `actorType` VARCHAR(191) NULL,
|
|
19
|
-
ADD COLUMN `eventGroup` VARCHAR(191) NULL,
|
|
20
|
-
ADD COLUMN `eventType` VARCHAR(191) NOT NULL,
|
|
21
|
-
ADD COLUMN `fromState` VARCHAR(191) NULL,
|
|
22
|
-
ADD COLUMN `occurredAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
23
|
-
ADD COLUMN `toState` VARCHAR(191) NULL,
|
|
24
|
-
ADD COLUMN `trigger` VARCHAR(191) NULL,
|
|
25
|
-
MODIFY `data` JSON NULL;
|
|
26
|
-
|
|
27
|
-
-- DropTable
|
|
28
|
-
DROP TABLE `contract_transitions`;
|
|
29
|
-
|
|
30
|
-
-- CreateIndex
|
|
31
|
-
CREATE INDEX `contract_events_eventType_idx` ON `contract_events`(`eventType`);
|
|
32
|
-
|
|
33
|
-
-- CreateIndex
|
|
34
|
-
CREATE INDEX `contract_events_eventGroup_idx` ON `contract_events`(`eventGroup`);
|
|
35
|
-
|
|
36
|
-
-- CreateIndex
|
|
37
|
-
CREATE INDEX `contract_events_occurredAt_idx` ON `contract_events`(`occurredAt`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
-- This is an empty migration.
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
-- AlterTable
|
|
2
|
-
ALTER TABLE `contract_phase_steps` ADD COLUMN `actionReason` TEXT NULL,
|
|
3
|
-
ADD COLUMN `lastSubmittedAt` DATETIME(3) NULL,
|
|
4
|
-
ADD COLUMN `submissionCount` INTEGER NOT NULL DEFAULT 0,
|
|
5
|
-
MODIFY `status` ENUM('PENDING', 'IN_PROGRESS', 'COMPLETED', 'FAILED', 'SKIPPED', 'NEEDS_RESUBMISSION', 'ACTION_REQUIRED', 'AWAITING_REVIEW') NOT NULL DEFAULT 'PENDING';
|
|
6
|
-
|
|
7
|
-
-- AlterTable
|
|
8
|
-
ALTER TABLE `contract_phases` ADD COLUMN `currentStepId` VARCHAR(191) NULL;
|
|
9
|
-
|
|
10
|
-
-- CreateIndex
|
|
11
|
-
CREATE INDEX `contract_phases_currentStepId_idx` ON `contract_phases`(`currentStepId`);
|
|
12
|
-
|
|
13
|
-
-- AddForeignKey
|
|
14
|
-
ALTER TABLE `contract_phases` ADD CONSTRAINT `contract_phases_currentStepId_fkey` FOREIGN KEY (`currentStepId`) REFERENCES `contract_phase_steps`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|