@valentine-efagene/qshelter-common 2.0.44 → 2.0.45

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.
@@ -1,11 +1,30 @@
1
1
  /**
2
- * Models that require tenant scoping
2
+ * Models that require tenant scoping.
3
+ *
4
+ * IMPORTANT: When adding a new model with tenantId to the schema,
5
+ * add it to this list so queries are automatically filtered by tenant.
6
+ *
7
+ * Models with nullable tenantId (for global templates) should also be
8
+ * added to OPTIONAL_TENANT_MODELS below.
3
9
  */
4
10
  const TENANT_SCOPED_MODELS = [
11
+ // Property domain
5
12
  "property",
6
- "paymentPlan",
7
13
  "propertyPaymentMethod",
14
+ // Payment plan domain
15
+ "paymentPlan",
16
+ // Contract domain
8
17
  "contract",
18
+ "contractTermination",
19
+ // Document domain
20
+ "documentTemplate",
21
+ "offerLetter",
22
+ "documentRequirementRule",
23
+ // Prequalification & underwriting domain
24
+ "prequalification",
25
+ "underwritingDecision",
26
+ // Payment method changes
27
+ "paymentMethodChangeRequest",
9
28
  ];
10
29
  /**
11
30
  * Models that can optionally have tenant scoping (nullable tenantId)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valentine-efagene/qshelter-common",
3
- "version": "2.0.44",
3
+ "version": "2.0.45",
4
4
  "description": "Shared database schemas and utilities for QShelter services",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -0,0 +1,11 @@
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;
@@ -1261,9 +1261,9 @@ model OfferLetter {
1261
1261
  contractId String
1262
1262
  contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)
1263
1263
 
1264
- // Template used
1265
- templateId String
1266
- template DocumentTemplate @relation(fields: [templateId], references: [id])
1264
+ // Template used (optional - documents-service may handle default selection)
1265
+ templateId String?
1266
+ template DocumentTemplate? @relation(fields: [templateId], references: [id])
1267
1267
 
1268
1268
  // Letter details
1269
1269
  letterNumber String @unique // OL-XXXXXX