@valentine-efagene/qshelter-common 2.0.113 → 2.0.115
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/enums.d.ts +2 -0
- package/dist/generated/client/enums.js +4 -2
- package/dist/generated/client/internal/class.js +2 -2
- package/dist/generated/client/internal/prismaNamespace.d.ts +6 -0
- package/dist/generated/client/internal/prismaNamespace.js +8 -2
- package/dist/generated/client/internal/prismaNamespaceBrowser.d.ts +6 -0
- package/dist/generated/client/internal/prismaNamespaceBrowser.js +8 -2
- package/dist/generated/client/models/Application.d.ts +793 -1
- package/dist/generated/client/models/ApplicationPhase.d.ts +277 -1
- package/dist/generated/client/models/PropertyPaymentMethodPhase.d.ts +295 -1
- package/package.json +1 -1
- package/prisma/migrations/20260115055636_add_unit_locking/migration.sql +16 -0
- package/prisma/migrations/20260115060132_add_phase_template_reference/migration.sql +8 -0
- package/prisma/schema.prisma +22 -0
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
-- AlterTable
|
|
2
|
+
ALTER TABLE `applications` ADD COLUMN `supersededAt` DATETIME(3) NULL,
|
|
3
|
+
ADD COLUMN `supersededById` VARCHAR(191) NULL,
|
|
4
|
+
MODIFY `status` ENUM('DRAFT', 'PENDING', 'ACTIVE', 'COMPLETED', 'CANCELLED', 'TERMINATED', 'TRANSFERRED', 'SUPERSEDED') NOT NULL DEFAULT 'DRAFT';
|
|
5
|
+
|
|
6
|
+
-- AlterTable
|
|
7
|
+
ALTER TABLE `event_handlers` MODIFY `handlerType` ENUM('SEND_EMAIL', 'SEND_SMS', 'SEND_PUSH', 'CALL_WEBHOOK', 'ADVANCE_WORKFLOW', 'RUN_AUTOMATION', 'LOCK_UNIT') NOT NULL;
|
|
8
|
+
|
|
9
|
+
-- AlterTable
|
|
10
|
+
ALTER TABLE `property_payment_method_phases` ADD COLUMN `lockUnitOnComplete` BOOLEAN NOT NULL DEFAULT false;
|
|
11
|
+
|
|
12
|
+
-- CreateIndex
|
|
13
|
+
CREATE INDEX `applications_supersededById_idx` ON `applications`(`supersededById`);
|
|
14
|
+
|
|
15
|
+
-- AddForeignKey
|
|
16
|
+
ALTER TABLE `applications` ADD CONSTRAINT `applications_supersededById_fkey` FOREIGN KEY (`supersededById`) REFERENCES `applications`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- AlterTable
|
|
2
|
+
ALTER TABLE `application_phases` ADD COLUMN `phaseTemplateId` VARCHAR(191) NULL;
|
|
3
|
+
|
|
4
|
+
-- CreateIndex
|
|
5
|
+
CREATE INDEX `application_phases_phaseTemplateId_idx` ON `application_phases`(`phaseTemplateId`);
|
|
6
|
+
|
|
7
|
+
-- AddForeignKey
|
|
8
|
+
ALTER TABLE `application_phases` ADD CONSTRAINT `application_phases_phaseTemplateId_fkey` FOREIGN KEY (`phaseTemplateId`) REFERENCES `property_payment_method_phases`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
package/prisma/schema.prisma
CHANGED
|
@@ -59,6 +59,7 @@ enum ApplicationStatus {
|
|
|
59
59
|
CANCELLED
|
|
60
60
|
TERMINATED
|
|
61
61
|
TRANSFERRED // Application was transferred to a different property
|
|
62
|
+
SUPERSEDED // Another buyer locked the unit - this application was outbid
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
enum TransferRequestStatus {
|
|
@@ -272,6 +273,7 @@ enum EventHandlerType {
|
|
|
272
273
|
CALL_WEBHOOK // Call an external API/webhook
|
|
273
274
|
ADVANCE_WORKFLOW // Advance or complete a workflow step
|
|
274
275
|
RUN_AUTOMATION // Execute internal business logic
|
|
276
|
+
LOCK_UNIT // Lock the property unit for the applicant, supersede competing applications
|
|
275
277
|
}
|
|
276
278
|
|
|
277
279
|
/// Actor Type - Who triggered an event
|
|
@@ -1331,6 +1333,11 @@ model PropertyPaymentMethodPhase {
|
|
|
1331
1333
|
minimumCompletionPercentage Float?
|
|
1332
1334
|
completionCriterion CompletionCriterion?
|
|
1333
1335
|
|
|
1336
|
+
// Unit locking configuration
|
|
1337
|
+
// If true, completing this phase locks the unit for the applicant
|
|
1338
|
+
// Only one phase per payment method should have this enabled
|
|
1339
|
+
lockUnitOnComplete Boolean @default(false)
|
|
1340
|
+
|
|
1334
1341
|
// Snapshots for audit (original config at creation time)
|
|
1335
1342
|
// These are still needed for inline definitions (backward compatibility)
|
|
1336
1343
|
stepDefinitionsSnapshot Json?
|
|
@@ -1346,6 +1353,8 @@ model PropertyPaymentMethodPhase {
|
|
|
1346
1353
|
questionnaireFields PaymentMethodPhaseField[]
|
|
1347
1354
|
// Event attachments - handlers that fire on phase transitions
|
|
1348
1355
|
eventAttachments PhaseEventAttachment[]
|
|
1356
|
+
// Application phases created from this template
|
|
1357
|
+
applicationPhases ApplicationPhase[]
|
|
1349
1358
|
|
|
1350
1359
|
@@index([tenantId])
|
|
1351
1360
|
@@index([paymentMethodId])
|
|
@@ -1627,6 +1636,13 @@ model Application {
|
|
|
1627
1636
|
transferredFrom Application? @relation("ApplicationTransfer", fields: [transferredFromId], references: [id])
|
|
1628
1637
|
transferredTo Application? @relation("ApplicationTransfer")
|
|
1629
1638
|
|
|
1639
|
+
// Supersede tracking - when another buyer locks the unit
|
|
1640
|
+
// If status is SUPERSEDED, this references the application that took the unit
|
|
1641
|
+
supersededById String?
|
|
1642
|
+
supersededBy Application? @relation("ApplicationSuperseded", fields: [supersededById], references: [id])
|
|
1643
|
+
supersededAt DateTime?
|
|
1644
|
+
supersededApplications Application[] @relation("ApplicationSuperseded")
|
|
1645
|
+
|
|
1630
1646
|
// Transfer requests where this contract is the source
|
|
1631
1647
|
outgoingTransferRequests PropertyTransferRequest[] @relation("SourceApplication")
|
|
1632
1648
|
// Transfer requests where this contract is the target (created after approval)
|
|
@@ -1645,6 +1661,7 @@ model Application {
|
|
|
1645
1661
|
@@index([paymentMethodId])
|
|
1646
1662
|
@@index([status])
|
|
1647
1663
|
@@index([currentPhaseId])
|
|
1664
|
+
@@index([supersededById])
|
|
1648
1665
|
@@map("applications")
|
|
1649
1666
|
}
|
|
1650
1667
|
|
|
@@ -1723,6 +1740,10 @@ model ApplicationPhase {
|
|
|
1723
1740
|
applicationId String
|
|
1724
1741
|
application Application @relation(fields: [applicationId], references: [id], onDelete: Cascade)
|
|
1725
1742
|
|
|
1743
|
+
// Reference to the phase template this was instantiated from
|
|
1744
|
+
phaseTemplateId String?
|
|
1745
|
+
phaseTemplate PropertyPaymentMethodPhase? @relation(fields: [phaseTemplateId], references: [id], onDelete: SetNull)
|
|
1746
|
+
|
|
1726
1747
|
// Admin-defined naming
|
|
1727
1748
|
name String
|
|
1728
1749
|
description String? @db.Text
|
|
@@ -1761,6 +1782,7 @@ model ApplicationPhase {
|
|
|
1761
1782
|
|
|
1762
1783
|
@@index([tenantId])
|
|
1763
1784
|
@@index([applicationId])
|
|
1785
|
+
@@index([phaseTemplateId])
|
|
1764
1786
|
@@index([phaseCategory])
|
|
1765
1787
|
@@index([status])
|
|
1766
1788
|
@@index([order])
|