dt-common-device 13.1.4 → 13.1.5
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.
|
@@ -20,5 +20,5 @@ export declare class AdminRepository {
|
|
|
20
20
|
getUser(userId: string): Promise<IUser | null>;
|
|
21
21
|
getZoneByDeviceId(deviceId: string): Promise<IZone | null>;
|
|
22
22
|
getAccessGroups(propertyId: string, accessibleBy?: string): Promise<IAccessGroup[]>;
|
|
23
|
-
|
|
23
|
+
getChildCollectionsByParentIds(parentIds: string[]): Promise<any[]>;
|
|
24
24
|
}
|
|
@@ -494,12 +494,16 @@ let AdminRepository = (() => {
|
|
|
494
494
|
throw new Error("Failed to get access groups");
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
async
|
|
497
|
+
async getChildCollectionsByParentIds(parentIds) {
|
|
498
498
|
try {
|
|
499
|
-
|
|
499
|
+
if (!parentIds || parentIds.length === 0) {
|
|
500
|
+
return [];
|
|
501
|
+
}
|
|
502
|
+
const result = await this.postgres.query(`SELECT * FROM dt_collection_hierarchy WHERE "parentCollectionId" = ANY($1)`, [parentIds]);
|
|
503
|
+
return result.rows;
|
|
500
504
|
}
|
|
501
505
|
catch (error) {
|
|
502
|
-
console.error("Error in
|
|
506
|
+
console.error("Error in getChildCollectionsByParentIds:", error);
|
|
503
507
|
return [];
|
|
504
508
|
}
|
|
505
509
|
}
|
|
@@ -13,5 +13,5 @@ export declare class AdminService {
|
|
|
13
13
|
getUser(userId: string): Promise<IUser | null>;
|
|
14
14
|
getZoneByDeviceId(deviceId: string): Promise<IZone | null>;
|
|
15
15
|
getAccessGroups(propertyId: string, accessibleBy?: string): Promise<IAccessGroup[]>;
|
|
16
|
-
|
|
16
|
+
getChildCollectionsByParentIds(parentIds: string[]): Promise<any[]>;
|
|
17
17
|
}
|
|
@@ -294,8 +294,9 @@ let AdminService = (() => {
|
|
|
294
294
|
}
|
|
295
295
|
return await this.adminRepository.getAccessGroups(propertyId, accessibleBy);
|
|
296
296
|
}
|
|
297
|
-
async
|
|
298
|
-
|
|
297
|
+
async getChildCollectionsByParentIds(parentIds) {
|
|
298
|
+
console.log("parentIds for collection heirarchy:----->", parentIds);
|
|
299
|
+
return await this.adminRepository.getChildCollectionsByParentIds(parentIds);
|
|
299
300
|
}
|
|
300
301
|
};
|
|
301
302
|
__setFunctionName(_classThis, "AdminService");
|