@valentine-efagene/qshelter-common 2.0.153 → 2.0.155
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/internal/class.js +2 -2
- package/dist/generated/client/internal/prismaNamespace.d.ts +2 -0
- package/dist/generated/client/internal/prismaNamespace.js +2 -0
- package/dist/generated/client/internal/prismaNamespaceBrowser.d.ts +2 -0
- package/dist/generated/client/internal/prismaNamespaceBrowser.js +2 -0
- package/dist/generated/client/models/Organization.d.ts +221 -0
- package/dist/generated/client/models/Property.d.ts +301 -1
- package/dist/src/events/notifications/event-publisher.d.ts +9 -0
- package/dist/src/events/notifications/event-publisher.js +16 -0
- package/package.json +1 -1
- package/prisma/migrations/20260126031132_add_organization_id_to_property/migration.sql +8 -0
- package/prisma/schema.prisma +15 -7
|
@@ -33,9 +33,18 @@ export declare class EventPublisher {
|
|
|
33
33
|
* Convenience method for publishing push notifications
|
|
34
34
|
*/
|
|
35
35
|
publishPush<T>(type: NotificationType, payload: T, meta?: Partial<NotificationMeta>): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Destroy the SNS client to allow process to exit cleanly (for tests)
|
|
38
|
+
*/
|
|
39
|
+
destroy(): void;
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
38
42
|
* Get or create an EventPublisher for a service
|
|
39
43
|
*/
|
|
40
44
|
export declare function getEventPublisher(serviceName: string, config?: EventPublisherConfig): EventPublisher;
|
|
45
|
+
/**
|
|
46
|
+
* Destroy all EventPublisher instances and their SNS clients.
|
|
47
|
+
* Call this in test teardown to allow Jest to exit cleanly.
|
|
48
|
+
*/
|
|
49
|
+
export declare function destroyAllEventPublishers(): void;
|
|
41
50
|
export {};
|
|
@@ -97,6 +97,12 @@ export class EventPublisher {
|
|
|
97
97
|
async publishPush(type, payload, meta) {
|
|
98
98
|
return this.publish(type, NotificationChannel.PUSH, payload, meta);
|
|
99
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Destroy the SNS client to allow process to exit cleanly (for tests)
|
|
102
|
+
*/
|
|
103
|
+
destroy() {
|
|
104
|
+
this.snsClient.destroy();
|
|
105
|
+
}
|
|
100
106
|
}
|
|
101
107
|
// Singleton instances per service
|
|
102
108
|
const publisherInstances = new Map();
|
|
@@ -109,3 +115,13 @@ export function getEventPublisher(serviceName, config) {
|
|
|
109
115
|
}
|
|
110
116
|
return publisherInstances.get(serviceName);
|
|
111
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Destroy all EventPublisher instances and their SNS clients.
|
|
120
|
+
* Call this in test teardown to allow Jest to exit cleanly.
|
|
121
|
+
*/
|
|
122
|
+
export function destroyAllEventPublishers() {
|
|
123
|
+
for (const publisher of publisherInstances.values()) {
|
|
124
|
+
publisher.destroy();
|
|
125
|
+
}
|
|
126
|
+
publisherInstances.clear();
|
|
127
|
+
}
|
package/package.json
CHANGED
|
@@ -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;
|
package/prisma/schema.prisma
CHANGED
|
@@ -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
|
|
709
|
-
|
|
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
|
|
@@ -1136,11 +1136,18 @@ model Settings {
|
|
|
1136
1136
|
// =============================================================================
|
|
1137
1137
|
|
|
1138
1138
|
model Property {
|
|
1139
|
-
id
|
|
1140
|
-
tenantId
|
|
1141
|
-
tenant
|
|
1142
|
-
userId
|
|
1143
|
-
user
|
|
1139
|
+
id String @id @default(cuid())
|
|
1140
|
+
tenantId String
|
|
1141
|
+
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
1142
|
+
userId String
|
|
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])
|