dt-common-device 9.2.7 → 9.2.8

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.
@@ -11,5 +11,5 @@ export declare class AdminRepository {
11
11
  getZone(zoneId: string): Promise<IZone | null>;
12
12
  getUser(userId: string): Promise<IUser | null>;
13
13
  getZoneByDeviceId(deviceId: string): Promise<IZone | null>;
14
- getAccessGroups(propertyId: string): Promise<IAccessGroup[]>;
14
+ getAccessGroups(propertyId: string, accessibleBy?: string): Promise<IAccessGroup[]>;
15
15
  }
@@ -302,9 +302,14 @@ let AdminRepository = (() => {
302
302
  throw new Error("Failed to get zone by device ID");
303
303
  }
304
304
  }
305
- async getAccessGroups(propertyId) {
305
+ async getAccessGroups(propertyId, accessibleBy) {
306
306
  try {
307
- const accessGroups = await this.postgres.query(`SELECT * FROM dt_collections WHERE "propertyId" = $1 AND "isDeleted" = false`, [propertyId]);
307
+ let accessGroups;
308
+ if (accessibleBy) {
309
+ accessGroups = await this.postgres.query(`SELECT * FROM dt_collections WHERE "propertyId" = $1 AND "accessibleBy" = $2 AND "isDeleted" = false`, [propertyId, accessibleBy]);
310
+ return accessGroups.rows;
311
+ }
312
+ accessGroups = await this.postgres.query(`SELECT * FROM dt_collections WHERE "propertyId" = $1 AND "isDeleted" = false`, [propertyId]);
308
313
  return accessGroups.rows;
309
314
  }
310
315
  catch (error) {
@@ -10,5 +10,5 @@ export declare class AdminService {
10
10
  getZone(zoneId: string): Promise<IZone | null>;
11
11
  getUser(userId: string): Promise<IUser | null>;
12
12
  getZoneByDeviceId(deviceId: string): Promise<IZone | null>;
13
- getAccessGroups(propertyId: string): Promise<IAccessGroup[]>;
13
+ getAccessGroups(propertyId: string, accessibleBy?: string): Promise<IAccessGroup[]>;
14
14
  }
@@ -156,11 +156,11 @@ let AdminService = (() => {
156
156
  return null;
157
157
  return zone;
158
158
  }
159
- async getAccessGroups(propertyId) {
159
+ async getAccessGroups(propertyId, accessibleBy) {
160
160
  if (!propertyId) {
161
161
  throw new Error("Property ID is required");
162
162
  }
163
- return await this.adminRepository.getAccessGroups(propertyId);
163
+ return await this.adminRepository.getAccessGroups(propertyId, accessibleBy);
164
164
  }
165
165
  };
166
166
  __setFunctionName(_classThis, "AdminService");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "9.2.7",
3
+ "version": "9.2.8",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [