@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,102 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `completedStepsCount` on the `documentation_phases` table. All the data in the column will be lost.
5
- - You are about to drop the column `completionCriterion` on the `documentation_phases` table. All the data in the column will be lost.
6
- - You are about to drop the column `currentStepId` on the `documentation_phases` table. All the data in the column will be lost.
7
- - You are about to drop the column `minimumCompletionPercentage` on the `documentation_phases` table. All the data in the column will be lost.
8
- - You are about to drop the column `requiredDocumentSnapshot` on the `documentation_phases` table. All the data in the column will be lost.
9
- - You are about to drop the column `stepDefinitionsSnapshot` on the `documentation_phases` table. All the data in the column will be lost.
10
- - You are about to drop the column `totalStepsCount` on the `documentation_phases` table. All the data in the column will be lost.
11
- - You are about to drop the `documentation_plan_steps` table. If the table is not empty, all the data it contains will be lost.
12
- - You are about to drop the `documentation_step_approvals` table. If the table is not empty, all the data it contains will be lost.
13
- - You are about to drop the `documentation_step_documents` table. If the table is not empty, all the data it contains will be lost.
14
- - You are about to drop the `documentation_steps` table. If the table is not empty, all the data it contains will be lost.
15
-
16
- */
17
- -- DropForeignKey
18
- ALTER TABLE `documentation_phases` DROP FOREIGN KEY `documentation_phases_currentStepId_fkey`;
19
-
20
- -- DropForeignKey
21
- ALTER TABLE `documentation_plan_steps` DROP FOREIGN KEY `documentation_plan_steps_planId_fkey`;
22
-
23
- -- DropForeignKey
24
- ALTER TABLE `documentation_step_approvals` DROP FOREIGN KEY `documentation_step_approvals_approverId_fkey`;
25
-
26
- -- DropForeignKey
27
- ALTER TABLE `documentation_step_approvals` DROP FOREIGN KEY `documentation_step_approvals_stepId_fkey`;
28
-
29
- -- DropForeignKey
30
- ALTER TABLE `documentation_step_approvals` DROP FOREIGN KEY `documentation_step_approvals_tenantId_fkey`;
31
-
32
- -- DropForeignKey
33
- ALTER TABLE `documentation_step_documents` DROP FOREIGN KEY `documentation_step_documents_stepId_fkey`;
34
-
35
- -- DropForeignKey
36
- ALTER TABLE `documentation_step_documents` DROP FOREIGN KEY `documentation_step_documents_tenantId_fkey`;
37
-
38
- -- DropForeignKey
39
- ALTER TABLE `documentation_steps` DROP FOREIGN KEY `documentation_steps_assigneeId_fkey`;
40
-
41
- -- DropForeignKey
42
- ALTER TABLE `documentation_steps` DROP FOREIGN KEY `documentation_steps_documentationPhaseId_fkey`;
43
-
44
- -- DropForeignKey
45
- ALTER TABLE `documentation_steps` DROP FOREIGN KEY `documentation_steps_gateActedById_fkey`;
46
-
47
- -- DropForeignKey
48
- ALTER TABLE `documentation_steps` DROP FOREIGN KEY `documentation_steps_tenantId_fkey`;
49
-
50
- -- DropIndex
51
- DROP INDEX `documentation_phases_currentStepId_idx` ON `documentation_phases`;
52
-
53
- -- AlterTable
54
- ALTER TABLE `documentation_phases` DROP COLUMN `completedStepsCount`,
55
- DROP COLUMN `completionCriterion`,
56
- DROP COLUMN `currentStepId`,
57
- DROP COLUMN `minimumCompletionPercentage`,
58
- DROP COLUMN `requiredDocumentSnapshot`,
59
- DROP COLUMN `stepDefinitionsSnapshot`,
60
- DROP COLUMN `totalStepsCount`,
61
- ADD COLUMN `approvalStagesSnapshot` JSON NULL,
62
- ADD COLUMN `currentStageOrder` INTEGER NOT NULL DEFAULT 1,
63
- ADD COLUMN `documentDefinitionsSnapshot` JSON NULL;
64
-
65
- -- DropTable
66
- DROP TABLE `documentation_plan_steps`;
67
-
68
- -- DropTable
69
- DROP TABLE `documentation_step_approvals`;
70
-
71
- -- DropTable
72
- DROP TABLE `documentation_step_documents`;
73
-
74
- -- DropTable
75
- DROP TABLE `documentation_steps`;
76
-
77
- -- CreateTable
78
- CREATE TABLE `questionnaire_phase_reviews` (
79
- `id` VARCHAR(191) NOT NULL,
80
- `tenantId` VARCHAR(191) NOT NULL,
81
- `questionnairePhaseId` VARCHAR(191) NOT NULL,
82
- `reviewerId` VARCHAR(191) NOT NULL,
83
- `decision` ENUM('PENDING', 'APPROVED', 'REJECTED', 'CHANGES_REQUESTED', 'WAIVED') NOT NULL,
84
- `notes` TEXT NULL,
85
- `scoreAtReview` INTEGER NULL,
86
- `passedAtReview` BOOLEAN NULL,
87
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
88
-
89
- INDEX `questionnaire_phase_reviews_tenantId_idx`(`tenantId`),
90
- INDEX `questionnaire_phase_reviews_questionnairePhaseId_idx`(`questionnairePhaseId`),
91
- INDEX `questionnaire_phase_reviews_reviewerId_idx`(`reviewerId`),
92
- PRIMARY KEY (`id`)
93
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
94
-
95
- -- AddForeignKey
96
- ALTER TABLE `questionnaire_phase_reviews` ADD CONSTRAINT `questionnaire_phase_reviews_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
97
-
98
- -- AddForeignKey
99
- ALTER TABLE `questionnaire_phase_reviews` ADD CONSTRAINT `questionnaire_phase_reviews_questionnairePhaseId_fkey` FOREIGN KEY (`questionnairePhaseId`) REFERENCES `questionnaire_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
100
-
101
- -- AddForeignKey
102
- ALTER TABLE `questionnaire_phase_reviews` ADD CONSTRAINT `questionnaire_phase_reviews_reviewerId_fkey` FOREIGN KEY (`reviewerId`) REFERENCES `users`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -1,198 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the `event_handler_executions` table. If the table is not empty, all the data it contains will be lost.
5
- - You are about to drop the `workflow_events` table. If the table is not empty, all the data it contains will be lost.
6
-
7
- */
8
- -- DropForeignKey
9
- ALTER TABLE `event_handler_executions` DROP FOREIGN KEY `event_handler_executions_eventId_fkey`;
10
-
11
- -- DropForeignKey
12
- ALTER TABLE `event_handler_executions` DROP FOREIGN KEY `event_handler_executions_handlerId_fkey`;
13
-
14
- -- DropForeignKey
15
- ALTER TABLE `event_handler_executions` DROP FOREIGN KEY `event_handler_executions_tenantId_fkey`;
16
-
17
- -- DropForeignKey
18
- ALTER TABLE `workflow_events` DROP FOREIGN KEY `workflow_events_eventTypeId_fkey`;
19
-
20
- -- DropForeignKey
21
- ALTER TABLE `workflow_events` DROP FOREIGN KEY `workflow_events_tenantId_fkey`;
22
-
23
- -- AlterTable
24
- ALTER TABLE `application_documents` ADD COLUMN `documentDate` DATETIME(3) NULL,
25
- ADD COLUMN `expectedOrganizationId` VARCHAR(191) NULL,
26
- ADD COLUMN `expectedUploader` ENUM('CUSTOMER', 'LENDER', 'DEVELOPER', 'LEGAL', 'INSURER', 'PLATFORM') NULL,
27
- ADD COLUMN `expiredAt` DATETIME(3) NULL,
28
- ADD COLUMN `expiresAt` DATETIME(3) NULL,
29
- ADD COLUMN `expiryDays` INTEGER NULL,
30
- ADD COLUMN `expiryWarningAt` DATETIME(3) NULL,
31
- ADD COLUMN `isExpired` BOOLEAN NOT NULL DEFAULT false,
32
- ADD COLUMN `revalidatedAt` DATETIME(3) NULL;
33
-
34
- -- AlterTable
35
- ALTER TABLE `application_events` MODIFY `eventGroup` ENUM('STATE_CHANGE', 'PAYMENT', 'DOCUMENT', 'NOTIFICATION', 'WORKFLOW', 'AUTOMATION') NULL,
36
- MODIFY `eventType` ENUM('APPLICATION_CREATED', 'APPLICATION_STATE_CHANGED', 'PHASE_ACTIVATED', 'PHASE_COMPLETED', 'STEP_COMPLETED', 'STEP_REJECTED', 'DOCUMENT_SUBMITTED', 'DOCUMENT_APPROVED', 'DOCUMENT_REJECTED', 'PAYMENT_INITIATED', 'PAYMENT_COMPLETED', 'PAYMENT_FAILED', 'INSTALLMENTS_GENERATED', 'APPLICATION_SIGNED', 'APPLICATION_TERMINATED', 'APPLICATION_TRANSFERRED', 'UNDERWRITING_COMPLETED', 'OFFER_LETTER_GENERATED', 'HANDLER_EXECUTED') NOT NULL;
37
-
38
- -- AlterTable
39
- ALTER TABLE `applications` ADD COLUMN `paymentMethodSnapshot` JSON NULL,
40
- ADD COLUMN `paymentMethodSnapshotAt` DATETIME(3) NULL,
41
- ADD COLUMN `paymentMethodSnapshotHash` VARCHAR(191) NULL;
42
-
43
- -- DropTable
44
- DROP TABLE `event_handler_executions`;
45
-
46
- -- DropTable
47
- DROP TABLE `workflow_events`;
48
-
49
- -- CreateTable
50
- CREATE TABLE `bank_document_requirements` (
51
- `id` VARCHAR(191) NOT NULL,
52
- `tenantId` VARCHAR(191) NOT NULL,
53
- `organizationId` VARCHAR(191) NOT NULL,
54
- `phaseType` VARCHAR(191) NOT NULL,
55
- `paymentMethodId` VARCHAR(191) NULL,
56
- `documentType` VARCHAR(191) NOT NULL,
57
- `documentName` VARCHAR(191) NOT NULL,
58
- `modifier` ENUM('REQUIRED', 'OPTIONAL', 'NOT_REQUIRED', 'STRICTER') NOT NULL DEFAULT 'REQUIRED',
59
- `description` TEXT NULL,
60
- `expiryDays` INTEGER NULL,
61
- `minFiles` INTEGER NULL,
62
- `maxFiles` INTEGER NULL,
63
- `allowedMimeTypes` VARCHAR(191) NULL,
64
- `validationRules` JSON NULL,
65
- `priority` INTEGER NOT NULL DEFAULT 100,
66
- `isActive` BOOLEAN NOT NULL DEFAULT true,
67
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
68
- `updatedAt` DATETIME(3) NOT NULL,
69
-
70
- INDEX `bank_document_requirements_tenantId_idx`(`tenantId`),
71
- INDEX `bank_document_requirements_organizationId_idx`(`organizationId`),
72
- INDEX `bank_document_requirements_phaseType_idx`(`phaseType`),
73
- INDEX `bank_document_requirements_documentType_idx`(`documentType`),
74
- INDEX `bank_document_requirements_paymentMethodId_idx`(`paymentMethodId`),
75
- UNIQUE INDEX `bank_document_requirements_organizationId_phaseType_document_key`(`organizationId`, `phaseType`, `documentType`, `paymentMethodId`),
76
- PRIMARY KEY (`id`)
77
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
78
-
79
- -- CreateTable
80
- CREATE TABLE `application_organizations` (
81
- `id` VARCHAR(191) NOT NULL,
82
- `tenantId` VARCHAR(191) NOT NULL,
83
- `applicationId` VARCHAR(191) NOT NULL,
84
- `organizationId` VARCHAR(191) NOT NULL,
85
- `role` ENUM('DEVELOPER', 'LENDER', 'LEGAL', 'INSURER', 'GOVERNMENT') NOT NULL,
86
- `status` ENUM('PENDING', 'ACTIVE', 'COMPLETED', 'DECLINED', 'WITHDRAWN') NOT NULL DEFAULT 'PENDING',
87
- `assignedById` VARCHAR(191) NULL,
88
- `assignedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
89
- `isPrimary` BOOLEAN NOT NULL DEFAULT false,
90
- `offeredTerms` JSON NULL,
91
- `termsOfferedAt` DATETIME(3) NULL,
92
- `termsAcceptedAt` DATETIME(3) NULL,
93
- `termsDeclinedAt` DATETIME(3) NULL,
94
- `declineReason` TEXT NULL,
95
- `activatedAt` DATETIME(3) NULL,
96
- `completedAt` DATETIME(3) NULL,
97
- `withdrawnAt` DATETIME(3) NULL,
98
- `slaHours` INTEGER NULL,
99
- `slaStartedAt` DATETIME(3) NULL,
100
- `slaBreachedAt` DATETIME(3) NULL,
101
- `slaBreachNotified` BOOLEAN NOT NULL DEFAULT false,
102
- `reminderCount` INTEGER NOT NULL DEFAULT 0,
103
- `lastReminderSentAt` DATETIME(3) NULL,
104
- `nextReminderAt` DATETIME(3) NULL,
105
- `escalatedAt` DATETIME(3) NULL,
106
- `escalatedToUserId` VARCHAR(191) NULL,
107
- `escalationNotes` TEXT NULL,
108
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
109
- `updatedAt` DATETIME(3) NOT NULL,
110
-
111
- INDEX `application_organizations_tenantId_idx`(`tenantId`),
112
- INDEX `application_organizations_applicationId_idx`(`applicationId`),
113
- INDEX `application_organizations_organizationId_idx`(`organizationId`),
114
- INDEX `application_organizations_role_idx`(`role`),
115
- INDEX `application_organizations_status_idx`(`status`),
116
- INDEX `application_organizations_isPrimary_idx`(`isPrimary`),
117
- INDEX `application_organizations_slaBreachedAt_idx`(`slaBreachedAt`),
118
- UNIQUE INDEX `application_organizations_applicationId_organizationId_role_key`(`applicationId`, `organizationId`, `role`),
119
- PRIMARY KEY (`id`)
120
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
121
-
122
- -- CreateTable
123
- CREATE TABLE `scheduled_jobs` (
124
- `id` VARCHAR(191) NOT NULL,
125
- `tenantId` VARCHAR(191) NULL,
126
- `jobType` ENUM('DOCUMENT_EXPIRY_CHECK', 'SLA_BREACH_CHECK', 'PAYMENT_REMINDER', 'DOCUMENT_EXPIRY_WARNING') NOT NULL,
127
- `status` ENUM('PENDING', 'RUNNING', 'COMPLETED', 'FAILED', 'CANCELLED') NOT NULL DEFAULT 'PENDING',
128
- `scheduledAt` DATETIME(3) NOT NULL,
129
- `startedAt` DATETIME(3) NULL,
130
- `completedAt` DATETIME(3) NULL,
131
- `durationMs` INTEGER NULL,
132
- `parameters` JSON NULL,
133
- `itemsProcessed` INTEGER NOT NULL DEFAULT 0,
134
- `itemsAffected` INTEGER NOT NULL DEFAULT 0,
135
- `errorCount` INTEGER NOT NULL DEFAULT 0,
136
- `errors` JSON NULL,
137
- `summary` TEXT NULL,
138
- `attemptNumber` INTEGER NOT NULL DEFAULT 1,
139
- `maxAttempts` INTEGER NOT NULL DEFAULT 3,
140
- `nextRetryAt` DATETIME(3) NULL,
141
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
142
- `updatedAt` DATETIME(3) NOT NULL,
143
-
144
- INDEX `scheduled_jobs_tenantId_idx`(`tenantId`),
145
- INDEX `scheduled_jobs_jobType_idx`(`jobType`),
146
- INDEX `scheduled_jobs_status_idx`(`status`),
147
- INDEX `scheduled_jobs_scheduledAt_idx`(`scheduledAt`),
148
- INDEX `scheduled_jobs_jobType_status_scheduledAt_idx`(`jobType`, `status`, `scheduledAt`),
149
- PRIMARY KEY (`id`)
150
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
151
-
152
- -- CreateTable
153
- CREATE TABLE `document_expiry_warnings` (
154
- `id` VARCHAR(191) NOT NULL,
155
- `tenantId` VARCHAR(191) NOT NULL,
156
- `documentId` VARCHAR(191) NOT NULL,
157
- `expiresAt` DATETIME(3) NOT NULL,
158
- `daysUntil` INTEGER NOT NULL,
159
- `warningSent` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
160
- `notificationSent` BOOLEAN NOT NULL DEFAULT false,
161
- `notificationId` VARCHAR(191) NULL,
162
- `resolved` BOOLEAN NOT NULL DEFAULT false,
163
- `resolvedAt` DATETIME(3) NULL,
164
- `resolvedBy` VARCHAR(191) NULL,
165
- `newDocumentId` VARCHAR(191) NULL,
166
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
167
-
168
- INDEX `document_expiry_warnings_tenantId_idx`(`tenantId`),
169
- INDEX `document_expiry_warnings_documentId_idx`(`documentId`),
170
- INDEX `document_expiry_warnings_expiresAt_idx`(`expiresAt`),
171
- INDEX `document_expiry_warnings_resolved_idx`(`resolved`),
172
- UNIQUE INDEX `document_expiry_warnings_documentId_daysUntil_key`(`documentId`, `daysUntil`),
173
- PRIMARY KEY (`id`)
174
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
175
-
176
- -- CreateIndex
177
- CREATE INDEX `application_documents_isExpired_idx` ON `application_documents`(`isExpired`);
178
-
179
- -- CreateIndex
180
- CREATE INDEX `application_documents_expiresAt_idx` ON `application_documents`(`expiresAt`);
181
-
182
- -- AddForeignKey
183
- ALTER TABLE `bank_document_requirements` ADD CONSTRAINT `bank_document_requirements_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
184
-
185
- -- AddForeignKey
186
- ALTER TABLE `bank_document_requirements` ADD CONSTRAINT `bank_document_requirements_organizationId_fkey` FOREIGN KEY (`organizationId`) REFERENCES `organizations`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
187
-
188
- -- AddForeignKey
189
- ALTER TABLE `bank_document_requirements` ADD CONSTRAINT `bank_document_requirements_paymentMethodId_fkey` FOREIGN KEY (`paymentMethodId`) REFERENCES `property_payment_methods`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
190
-
191
- -- AddForeignKey
192
- ALTER TABLE `application_organizations` ADD CONSTRAINT `application_organizations_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
193
-
194
- -- AddForeignKey
195
- ALTER TABLE `application_organizations` ADD CONSTRAINT `application_organizations_applicationId_fkey` FOREIGN KEY (`applicationId`) REFERENCES `applications`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
196
-
197
- -- AddForeignKey
198
- ALTER TABLE `application_organizations` ADD CONSTRAINT `application_organizations_organizationId_fkey` FOREIGN KEY (`organizationId`) REFERENCES `organizations`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
@@ -1,12 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - A unique constraint covering the columns `[phaseId,order]` on the table `payment_method_phase_steps` will be added. If there are existing duplicate values, this will fail.
5
- - A unique constraint covering the columns `[paymentMethodId,order]` on the table `property_payment_method_phases` will be added. If there are existing duplicate values, this will fail.
6
-
7
- */
8
- -- CreateIndex
9
- CREATE UNIQUE INDEX `payment_method_phase_steps_phaseId_order_key` ON `payment_method_phase_steps`(`phaseId`, `order`);
10
-
11
- -- CreateIndex
12
- CREATE UNIQUE INDEX `property_payment_method_phases_paymentMethodId_order_key` ON `property_payment_method_phases`(`paymentMethodId`, `order`);
@@ -1,14 +0,0 @@
1
- -- DropForeignKey
2
- ALTER TABLE `applications` DROP FOREIGN KEY `applications_propertyUnitId_fkey`;
3
-
4
- -- AlterTable
5
- ALTER TABLE `payment_installments` ADD COLUMN `version` INTEGER NOT NULL DEFAULT 0;
6
-
7
- -- AlterTable
8
- ALTER TABLE `payment_phases` ADD COLUMN `version` INTEGER NOT NULL DEFAULT 0;
9
-
10
- -- AlterTable
11
- ALTER TABLE `property_units` ADD COLUMN `version` INTEGER NOT NULL DEFAULT 0;
12
-
13
- -- AddForeignKey
14
- ALTER TABLE `applications` ADD CONSTRAINT `applications_propertyUnitId_fkey` FOREIGN KEY (`propertyUnitId`) REFERENCES `property_units`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -1,10 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `isPublished` on the `properties` table. All the data in the column will be lost.
5
- - You are about to alter the column `status` on the `properties` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(5))`.
6
-
7
- */
8
- -- AlterTable
9
- ALTER TABLE `properties` DROP COLUMN `isPublished`,
10
- MODIFY `status` ENUM('DRAFT', 'PUBLISHED', 'SOLD_OUT', 'ARCHIVED') NOT NULL DEFAULT 'DRAFT';
@@ -1,153 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `role` on the `application_organizations` table. All the data in the column will be lost.
5
- - You are about to drop the column `reviewParty` on the `approval_stage_progress` table. All the data in the column will be lost.
6
- - You are about to drop the column `organizationId` on the `approval_stages` table. All the data in the column will be lost.
7
- - You are about to drop the column `reviewParty` on the `approval_stages` table. All the data in the column will be lost.
8
- - You are about to drop the column `reviewParty` on the `document_approvals` table. All the data in the column will be lost.
9
- - You are about to drop the column `reviewParty` on the `document_reviews` table. All the data in the column will be lost.
10
- - You are about to drop the column `approvalLimit` on the `organization_members` table. All the data in the column will be lost.
11
- - You are about to drop the column `canApprove` on the `organization_members` table. All the data in the column will be lost.
12
- - You are about to drop the column `role` on the `organization_members` table. All the data in the column will be lost.
13
- - You are about to drop the column `type` on the `organizations` table. All the data in the column will be lost.
14
- - A unique constraint covering the columns `[applicationId,assignedAsTypeId]` on the table `application_organizations` will be added. If there are existing duplicate values, this will fail.
15
- - A unique constraint covering the columns `[documentId,organizationId]` on the table `document_reviews` will be added. If there are existing duplicate values, this will fail.
16
- - Added the required column `assignedAsTypeId` to the `application_organizations` table without a default value. This is not possible if the table is not empty.
17
- - Added the required column `organizationTypeId` to the `approval_stage_progress` table without a default value. This is not possible if the table is not empty.
18
- - Added the required column `organizationTypeId` to the `approval_stages` table without a default value. This is not possible if the table is not empty.
19
- - Added the required column `organizationTypeId` to the `document_approvals` table without a default value. This is not possible if the table is not empty.
20
-
21
- */
22
- -- DropForeignKey
23
- ALTER TABLE `application_organizations` DROP FOREIGN KEY `application_organizations_applicationId_fkey`;
24
-
25
- -- DropForeignKey
26
- ALTER TABLE `document_reviews` DROP FOREIGN KEY `document_reviews_documentId_fkey`;
27
-
28
- -- DropIndex
29
- DROP INDEX `application_organizations_applicationId_organizationId_role_key` ON `application_organizations`;
30
-
31
- -- DropIndex
32
- DROP INDEX `application_organizations_role_idx` ON `application_organizations`;
33
-
34
- -- DropIndex
35
- DROP INDEX `document_reviews_documentId_reviewParty_organizationId_key` ON `document_reviews`;
36
-
37
- -- DropIndex
38
- DROP INDEX `document_reviews_reviewParty_idx` ON `document_reviews`;
39
-
40
- -- DropIndex
41
- DROP INDEX `organization_members_role_idx` ON `organization_members`;
42
-
43
- -- DropIndex
44
- DROP INDEX `organizations_type_idx` ON `organizations`;
45
-
46
- -- AlterTable
47
- ALTER TABLE `application_organizations` DROP COLUMN `role`,
48
- ADD COLUMN `assignedAsTypeId` VARCHAR(191) NOT NULL;
49
-
50
- -- AlterTable
51
- ALTER TABLE `approval_stage_progress` DROP COLUMN `reviewParty`,
52
- ADD COLUMN `organizationTypeId` VARCHAR(191) NOT NULL;
53
-
54
- -- AlterTable
55
- ALTER TABLE `approval_stages` DROP COLUMN `organizationId`,
56
- DROP COLUMN `reviewParty`,
57
- ADD COLUMN `organizationTypeId` VARCHAR(191) NOT NULL;
58
-
59
- -- AlterTable
60
- ALTER TABLE `document_approvals` DROP COLUMN `reviewParty`,
61
- ADD COLUMN `organizationTypeId` VARCHAR(191) NOT NULL;
62
-
63
- -- AlterTable
64
- ALTER TABLE `document_reviews` DROP COLUMN `reviewParty`,
65
- ADD COLUMN `organizationTypeId` VARCHAR(191) NULL;
66
-
67
- -- AlterTable
68
- ALTER TABLE `organization_members` DROP COLUMN `approvalLimit`,
69
- DROP COLUMN `canApprove`,
70
- DROP COLUMN `role`,
71
- ADD COLUMN `joinedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3);
72
-
73
- -- AlterTable
74
- ALTER TABLE `organizations` DROP COLUMN `type`;
75
-
76
- -- CreateTable
77
- CREATE TABLE `organization_types` (
78
- `id` VARCHAR(191) NOT NULL,
79
- `tenantId` VARCHAR(191) NOT NULL,
80
- `code` VARCHAR(191) NOT NULL,
81
- `name` VARCHAR(191) NOT NULL,
82
- `description` TEXT NULL,
83
- `isSystemType` BOOLEAN NOT NULL DEFAULT false,
84
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
85
- `updatedAt` DATETIME(3) NOT NULL,
86
-
87
- INDEX `organization_types_tenantId_idx`(`tenantId`),
88
- INDEX `organization_types_code_idx`(`code`),
89
- UNIQUE INDEX `organization_types_tenantId_code_key`(`tenantId`, `code`),
90
- PRIMARY KEY (`id`)
91
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
92
-
93
- -- CreateTable
94
- CREATE TABLE `organization_type_assignments` (
95
- `id` VARCHAR(191) NOT NULL,
96
- `organizationId` VARCHAR(191) NOT NULL,
97
- `typeId` VARCHAR(191) NOT NULL,
98
- `isPrimary` BOOLEAN NOT NULL DEFAULT false,
99
- `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
100
-
101
- INDEX `organization_type_assignments_organizationId_idx`(`organizationId`),
102
- INDEX `organization_type_assignments_typeId_idx`(`typeId`),
103
- UNIQUE INDEX `organization_type_assignments_organizationId_typeId_key`(`organizationId`, `typeId`),
104
- PRIMARY KEY (`id`)
105
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
106
-
107
- -- CreateIndex
108
- CREATE INDEX `application_organizations_assignedAsTypeId_idx` ON `application_organizations`(`assignedAsTypeId`);
109
-
110
- -- CreateIndex
111
- CREATE UNIQUE INDEX `application_organizations_applicationId_assignedAsTypeId_key` ON `application_organizations`(`applicationId`, `assignedAsTypeId`);
112
-
113
- -- CreateIndex
114
- CREATE INDEX `approval_stages_organizationTypeId_idx` ON `approval_stages`(`organizationTypeId`);
115
-
116
- -- CreateIndex
117
- CREATE INDEX `document_approvals_organizationTypeId_idx` ON `document_approvals`(`organizationTypeId`);
118
-
119
- -- CreateIndex
120
- CREATE INDEX `document_reviews_organizationId_idx` ON `document_reviews`(`organizationId`);
121
-
122
- -- CreateIndex
123
- CREATE INDEX `document_reviews_organizationTypeId_idx` ON `document_reviews`(`organizationTypeId`);
124
-
125
- -- CreateIndex
126
- CREATE UNIQUE INDEX `document_reviews_documentId_organizationId_key` ON `document_reviews`(`documentId`, `organizationId`);
127
-
128
- -- AddForeignKey
129
- ALTER TABLE `organization_types` ADD CONSTRAINT `organization_types_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
130
-
131
- -- AddForeignKey
132
- ALTER TABLE `organization_type_assignments` ADD CONSTRAINT `organization_type_assignments_organizationId_fkey` FOREIGN KEY (`organizationId`) REFERENCES `organizations`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
133
-
134
- -- AddForeignKey
135
- ALTER TABLE `organization_type_assignments` ADD CONSTRAINT `organization_type_assignments_typeId_fkey` FOREIGN KEY (`typeId`) REFERENCES `organization_types`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
136
-
137
- -- AddForeignKey
138
- ALTER TABLE `approval_stages` ADD CONSTRAINT `approval_stages_organizationTypeId_fkey` FOREIGN KEY (`organizationTypeId`) REFERENCES `organization_types`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
139
-
140
- -- AddForeignKey
141
- ALTER TABLE `application_organizations` ADD CONSTRAINT `application_organizations_assignedAsTypeId_fkey` FOREIGN KEY (`assignedAsTypeId`) REFERENCES `organization_types`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
142
-
143
- -- AddForeignKey
144
- ALTER TABLE `document_reviews` ADD CONSTRAINT `document_reviews_organizationId_fkey` FOREIGN KEY (`organizationId`) REFERENCES `organizations`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
145
-
146
- -- AddForeignKey
147
- ALTER TABLE `document_reviews` ADD CONSTRAINT `document_reviews_organizationTypeId_fkey` FOREIGN KEY (`organizationTypeId`) REFERENCES `organization_types`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
148
-
149
- -- AddForeignKey
150
- ALTER TABLE `approval_stage_progress` ADD CONSTRAINT `approval_stage_progress_organizationTypeId_fkey` FOREIGN KEY (`organizationTypeId`) REFERENCES `organization_types`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
151
-
152
- -- AddForeignKey
153
- ALTER TABLE `document_approvals` ADD CONSTRAINT `document_approvals_organizationTypeId_fkey` FOREIGN KEY (`organizationTypeId`) REFERENCES `organization_types`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -1,5 +0,0 @@
1
- -- AddForeignKey
2
- ALTER TABLE `application_organizations` ADD CONSTRAINT `application_organizations_applicationId_fkey` FOREIGN KEY (`applicationId`) REFERENCES `applications`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
3
-
4
- -- AddForeignKey
5
- ALTER TABLE `document_reviews` ADD CONSTRAINT `document_reviews_documentId_fkey` FOREIGN KEY (`documentId`) REFERENCES `application_documents`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
@@ -1,8 +0,0 @@
1
- -- AlterTable
2
- ALTER TABLE `properties` ADD COLUMN `organizationId` VARCHAR(191) NULL;
3
-
4
- -- CreateIndex
5
- CREATE INDEX `properties_organizationId_idx` ON `properties`(`organizationId`);
6
-
7
- -- AddForeignKey
8
- ALTER TABLE `properties` ADD CONSTRAINT `properties_organizationId_fkey` FOREIGN KEY (`organizationId`) REFERENCES `organizations`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
@@ -1,3 +0,0 @@
1
- # Please do not edit this file manually
2
- # It should be added in your version-control system (e.g., Git)
3
- provider = "mysql"