@valentine-efagene/qshelter-common 2.0.153 → 2.0.154

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valentine-efagene/qshelter-common",
3
- "version": "2.0.153",
3
+ "version": "2.0.154",
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,8 @@
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;
@@ -705,8 +705,8 @@ model Organization {
705
705
  // Document reviews performed by this organization
706
706
  documentReviews DocumentReview[]
707
707
 
708
- // Properties developed by this organization (for DEVELOPERs)
709
- // developedProperties Property[] @relation("PropertyDeveloper")
708
+ // Properties owned/developed by this organization
709
+ properties Property[]
710
710
 
711
711
  @@unique([tenantId, bankCode]) // Bank codes unique within tenant
712
712
  @@unique([tenantId, cacNumber]) // CAC numbers unique within tenant
@@ -1141,6 +1141,13 @@ model Property {
1141
1141
  tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
1142
1142
  userId String
1143
1143
  user User @relation(fields: [userId], references: [id], onDelete: Cascade)
1144
+
1145
+ // Optional organization ownership
1146
+ // If set, any member of this organization with DEVELOPER role can manage the property
1147
+ // If null, only the userId owner can manage it (individual seller)
1148
+ organizationId String?
1149
+ organization Organization? @relation(fields: [organizationId], references: [id], onDelete: SetNull)
1150
+
1144
1151
  title String
1145
1152
  category String // SALE, RENT, LEASE
1146
1153
  propertyType String // APARTMENT, HOUSE, LAND, COMMERCIAL, ESTATE, TOWNHOUSE
@@ -1169,6 +1176,7 @@ model Property {
1169
1176
 
1170
1177
  @@index([tenantId])
1171
1178
  @@index([userId])
1179
+ @@index([organizationId])
1172
1180
  @@index([category])
1173
1181
  @@index([propertyType])
1174
1182
  @@index([city])