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
- queryCollectionHierarchy(filter: any): Promise<any>;
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 queryCollectionHierarchy(filter) {
497
+ async getChildCollectionsByParentIds(parentIds) {
498
498
  try {
499
- return await this.postgres.query(filter);
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 queryCollectionHierarchy:", error);
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
- queryCollectionHierarchy(filter: any): Promise<any>;
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 queryCollectionHierarchy(filter) {
298
- return await this.adminRepository.queryCollectionHierarchy(filter);
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");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "13.1.4",
3
+ "version": "13.1.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [