dt-common-device 9.2.6 → 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,4 +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, accessibleBy?: string): Promise<IAccessGroup[]>;
14
15
  }
@@ -302,6 +302,21 @@ let AdminRepository = (() => {
302
302
  throw new Error("Failed to get zone by device ID");
303
303
  }
304
304
  }
305
+ async getAccessGroups(propertyId, accessibleBy) {
306
+ try {
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]);
313
+ return accessGroups.rows;
314
+ }
315
+ catch (error) {
316
+ console.error("Error in getAccessGroups:", error);
317
+ throw new Error("Failed to get access groups");
318
+ }
319
+ }
305
320
  };
306
321
  __setFunctionName(_classThis, "AdminRepository");
307
322
  (() => {
@@ -10,4 +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, accessibleBy?: string): Promise<IAccessGroup[]>;
13
14
  }
@@ -156,6 +156,12 @@ let AdminService = (() => {
156
156
  return null;
157
157
  return zone;
158
158
  }
159
+ async getAccessGroups(propertyId, accessibleBy) {
160
+ if (!propertyId) {
161
+ throw new Error("Property ID is required");
162
+ }
163
+ return await this.adminRepository.getAccessGroups(propertyId, accessibleBy);
164
+ }
159
165
  };
160
166
  __setFunctionName(_classThis, "AdminService");
161
167
  (() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "9.2.6",
3
+ "version": "9.2.8",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [