dt-common-device 6.2.0 → 7.0.0

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.
@@ -52,6 +52,8 @@ let IssueRepository = (() => {
52
52
  const query = {};
53
53
  if (filters.propertyId)
54
54
  query.propertyId = filters.propertyId;
55
+ if (filters.zoneId)
56
+ query.zoneId = filters.zoneId;
55
57
  if (filters.assignedTo)
56
58
  query.assignedTo = filters.assignedTo;
57
59
  if (filters.status)
@@ -100,7 +102,8 @@ let IssueRepository = (() => {
100
102
  if (!includeDeleted) {
101
103
  query.isDeleted = false;
102
104
  }
103
- return await Issue_model_1.IssueModel.findOne(query);
105
+ const result = await Issue_model_1.IssueModel.findOne(query);
106
+ return result ? result.toObject() : null;
104
107
  }
105
108
  catch (error) {
106
109
  throw new Error(`Failed to find issue by ID: ${error instanceof Error ? error.message : "Unknown error"}`);
@@ -123,7 +126,8 @@ let IssueRepository = (() => {
123
126
  queryBuilder.skip(filters.skip);
124
127
  if (filters.limit)
125
128
  queryBuilder.limit(filters.limit);
126
- return await queryBuilder.exec();
129
+ const results = await queryBuilder.exec();
130
+ return results.map((result) => result.toObject());
127
131
  }
128
132
  catch (error) {
129
133
  throw new Error(`Failed to find issues: ${error instanceof Error ? error.message : "Unknown error"}`);
@@ -134,7 +138,8 @@ let IssueRepository = (() => {
134
138
  */
135
139
  async update(id, updateData) {
136
140
  try {
137
- return await Issue_model_1.IssueModel.findByIdAndUpdate(id, { ...updateData, updatedAt: new Date() }, { new: true, runValidators: true });
141
+ const result = await Issue_model_1.IssueModel.findByIdAndUpdate(id, { ...updateData, updatedAt: new Date() }, { new: true, runValidators: true });
142
+ return result ? result.toObject() : null;
138
143
  }
139
144
  catch (error) {
140
145
  throw new Error(`Failed to update issue: ${error instanceof Error ? error.message : "Unknown error"}`);
@@ -226,6 +231,8 @@ let IssueRepository = (() => {
226
231
  };
227
232
  if (filters.propertyId)
228
233
  query.propertyId = filters.propertyId;
234
+ if (filters.zoneId)
235
+ query.zoneId = filters.zoneId;
229
236
  if (!filters.includeDeleted)
230
237
  query.isDeleted = false;
231
238
  const queryBuilder = Issue_model_1.IssueModel.find(query).sort({ createdAt: -1 });
@@ -233,7 +240,8 @@ let IssueRepository = (() => {
233
240
  queryBuilder.skip(filters.skip);
234
241
  if (filters.limit)
235
242
  queryBuilder.limit(filters.limit);
236
- return await queryBuilder.exec();
243
+ const results = await queryBuilder.exec();
244
+ return results.map((result) => result.toObject());
237
245
  }
238
246
  catch (error) {
239
247
  throw new Error(`Failed to search issues: ${error instanceof Error ? error.message : "Unknown error"}`);
@@ -242,11 +250,13 @@ let IssueRepository = (() => {
242
250
  /**
243
251
  * Get issue statistics
244
252
  */
245
- async getStatistics(propertyId) {
253
+ async getStatistics(propertyId, zoneId) {
246
254
  try {
247
255
  const query = { isDeleted: false };
248
256
  if (propertyId)
249
257
  query.propertyId = propertyId;
258
+ if (zoneId)
259
+ query.zoneId = zoneId;
250
260
  const [total, pending, inProgress, resolved, closed, overdue, priorityStats, categoryStats,] = await Promise.all([
251
261
  Issue_model_1.IssueModel.countDocuments(query),
252
262
  Issue_model_1.IssueModel.countDocuments({ ...query, status: issue_types_1.IssueStatus.PENDING }),
@@ -337,6 +347,57 @@ let IssueRepository = (() => {
337
347
  throw new Error(`Failed to bulk soft delete issues: ${error instanceof Error ? error.message : "Unknown error"}`);
338
348
  }
339
349
  }
350
+ /**
351
+ * Find issues by zone ID
352
+ */
353
+ async findByZoneId(zoneId, includeDeleted = false) {
354
+ try {
355
+ const query = { zoneId };
356
+ if (!includeDeleted) {
357
+ query.isDeleted = false;
358
+ }
359
+ const results = await Issue_model_1.IssueModel.find(query).sort({ createdAt: -1 });
360
+ return results.map((result) => result.toObject());
361
+ }
362
+ catch (error) {
363
+ throw new Error(`Failed to find issues by zone ID: ${error instanceof Error ? error.message : "Unknown error"}`);
364
+ }
365
+ }
366
+ /**
367
+ * Find issues by zone ID and status
368
+ */
369
+ async findByZoneIdAndStatus(zoneId, status, includeDeleted = false) {
370
+ try {
371
+ const query = { zoneId, status };
372
+ if (!includeDeleted) {
373
+ query.isDeleted = false;
374
+ }
375
+ const results = await Issue_model_1.IssueModel.find(query).sort({ createdAt: -1 });
376
+ return results.map((result) => result.toObject());
377
+ }
378
+ catch (error) {
379
+ throw new Error(`Failed to find issues by zone ID and status: ${error instanceof Error ? error.message : "Unknown error"}`);
380
+ }
381
+ }
382
+ /**
383
+ * Find issues by multiple zone IDs
384
+ */
385
+ async findByZoneIds(zoneIds, includeDeleted = false) {
386
+ try {
387
+ if (!zoneIds || zoneIds.length === 0) {
388
+ throw new Error("Zone IDs array is required and cannot be empty");
389
+ }
390
+ const query = { zoneId: { $in: zoneIds } };
391
+ if (!includeDeleted) {
392
+ query.isDeleted = false;
393
+ }
394
+ const results = await Issue_model_1.IssueModel.find(query).sort({ createdAt: -1 });
395
+ return results.map((result) => result.toObject());
396
+ }
397
+ catch (error) {
398
+ throw new Error(`Failed to find issues by zone IDs: ${error instanceof Error ? error.message : "Unknown error"}`);
399
+ }
400
+ }
340
401
  };
341
402
  __setFunctionName(_classThis, "IssueRepository");
342
403
  (() => {
@@ -38,6 +38,7 @@ export declare class IssueService {
38
38
  * Create issue for device going offline longer than baseline
39
39
  */
40
40
  createDeviceOfflineIssue(device: IDevice, source: Source, reason?: string): Promise<IIssueDocument>;
41
+ createDoorLeftOpenIssue(device: IDevice, source: Source, reason?: string): Promise<IIssueDocument>;
41
42
  /**
42
43
  * Create issue for device battery level below threshold (READINESS + OPERATIONAL + ENERGY)
43
44
  */
@@ -122,7 +123,7 @@ export declare class IssueService {
122
123
  /**
123
124
  * Get issue statistics with business logic
124
125
  */
125
- getIssueStatistics(propertyId?: string): Promise<{
126
+ getIssueStatistics(propertyId?: string, zoneId?: string): Promise<{
126
127
  total: number;
127
128
  pending: number;
128
129
  inProgress: number;
@@ -137,10 +138,23 @@ export declare class IssueService {
137
138
  */
138
139
  searchIssues(searchTerm: string, filters?: {
139
140
  propertyId?: string;
141
+ zoneId?: string;
140
142
  includeDeleted?: boolean;
141
143
  limit?: number;
142
144
  skip?: number;
143
145
  }): Promise<IIssueDocument[]>;
146
+ /**
147
+ * Get issues by zone ID
148
+ */
149
+ getIssuesByZoneId(zoneId: string, includeDeleted?: boolean): Promise<IIssueDocument[]>;
150
+ /**
151
+ * Get issues by zone ID and status
152
+ */
153
+ getIssuesByZoneIdAndStatus(zoneId: string, status: string, includeDeleted?: boolean): Promise<IIssueDocument[]>;
154
+ /**
155
+ * Get issues by multiple zone IDs
156
+ */
157
+ getIssuesByZoneIds(zoneIds: string[], includeDeleted?: boolean): Promise<IIssueDocument[]>;
144
158
  private validateIssueData;
145
159
  private validateFilters;
146
160
  private validateUpdateData;
@@ -77,6 +77,7 @@ const Issue_repository_1 = require("./Issue.repository");
77
77
  const Issue_model_1 = require("./Issue.model");
78
78
  const issue_types_1 = require("./issue.types");
79
79
  const IssueBuilder_1 = require("./IssueBuilder");
80
+ const Admin_service_1 = require("../entities/admin/Admin.service");
80
81
  let IssueService = (() => {
81
82
  let _classDecorators = [(0, typedi_1.Service)()];
82
83
  let _classDescriptor;
@@ -92,6 +93,7 @@ let IssueService = (() => {
92
93
  async createReadinessIssue(data) {
93
94
  const issueBuilder = IssueBuilder_1.IssueBuilder.createReadinessIssue()
94
95
  .setPropertyId(data.propertyId)
96
+ .setZoneId(data.zoneId)
95
97
  .setTitle(data.title)
96
98
  .setDescription(data.description)
97
99
  .setCreatedBy(data.createdBy);
@@ -111,6 +113,7 @@ let IssueService = (() => {
111
113
  async createOperationsIssue(data) {
112
114
  const issueBuilder = IssueBuilder_1.IssueBuilder.createOperationsIssue()
113
115
  .setPropertyId(data.propertyId)
116
+ .setZoneId(data.zoneId)
114
117
  .setTitle(data.title)
115
118
  .setDescription(data.description)
116
119
  .setCreatedBy(data.createdBy);
@@ -130,6 +133,7 @@ let IssueService = (() => {
130
133
  async createSecurityIssue(data) {
131
134
  const issueBuilder = IssueBuilder_1.IssueBuilder.createSecurityIssue()
132
135
  .setPropertyId(data.propertyId)
136
+ .setZoneId(data.zoneId)
133
137
  .setTitle(data.title)
134
138
  .setDescription(data.description)
135
139
  .setCreatedBy(data.createdBy);
@@ -149,6 +153,7 @@ let IssueService = (() => {
149
153
  async createEnergyIssue(data) {
150
154
  const issueBuilder = IssueBuilder_1.IssueBuilder.createEnergyIssue()
151
155
  .setPropertyId(data.propertyId)
156
+ .setZoneId(data.zoneId)
152
157
  .setTitle(data.title)
153
158
  .setDescription(data.description)
154
159
  .setCreatedBy(data.createdBy);
@@ -166,7 +171,7 @@ let IssueService = (() => {
166
171
  * Create a device-specific issue using IssueBuilder
167
172
  */
168
173
  async createDeviceIssue(data) {
169
- const issueBuilder = IssueBuilder_1.IssueBuilder.createDeviceIssue(data.entityId, data.propertyId)
174
+ const issueBuilder = IssueBuilder_1.IssueBuilder.createDeviceIssue(data.entityId, data.propertyId, data.zoneId)
170
175
  .setTitle(data.title)
171
176
  .setDescription(data.description)
172
177
  .setCreatedBy(data.createdBy);
@@ -184,7 +189,7 @@ let IssueService = (() => {
184
189
  * Create a hub-specific issue using IssueBuilder
185
190
  */
186
191
  async createHubIssue(data) {
187
- const issueBuilder = IssueBuilder_1.IssueBuilder.createHubIssue(data.entityId, data.propertyId)
192
+ const issueBuilder = IssueBuilder_1.IssueBuilder.createHubIssue(data.entityId, data.propertyId, data.zoneId)
188
193
  .setTitle(data.title)
189
194
  .setDescription(data.description)
190
195
  .setCreatedBy(data.createdBy);
@@ -202,7 +207,7 @@ let IssueService = (() => {
202
207
  * Create a user-specific issue using IssueBuilder
203
208
  */
204
209
  async createUserIssue(data) {
205
- const issueBuilder = IssueBuilder_1.IssueBuilder.createUserIssue(data.entityId, data.propertyId)
210
+ const issueBuilder = IssueBuilder_1.IssueBuilder.createUserIssue(data.entityId, data.propertyId, data.zoneId)
206
211
  .setTitle(data.title)
207
212
  .setDescription(data.description)
208
213
  .setCreatedBy(data.createdBy);
@@ -224,6 +229,7 @@ let IssueService = (() => {
224
229
  entityId: device.deviceId,
225
230
  entityType: issue_types_1.EntityType.DEVICE,
226
231
  propertyId: device.propertyId,
232
+ zoneId: device.zoneId,
227
233
  title: "Device Offline - Requires Attention",
228
234
  description: `Device ${device.name} (${device.deviceId}) has been offline for longer than the baseline time. ${reason ? `Reason: ${reason}` : ""} This requires immediate attention to restore device functionality.`,
229
235
  createdBy: source,
@@ -231,6 +237,20 @@ let IssueService = (() => {
231
237
  priority: issue_types_1.IssuePriority.HIGH,
232
238
  });
233
239
  }
240
+ async createDoorLeftOpenIssue(device, source, reason) {
241
+ const zone = await typedi_1.default.get(Admin_service_1.AdminService).getZone(device.zoneId);
242
+ return await this.createDeviceIssue({
243
+ entityId: device.deviceId,
244
+ entityType: issue_types_1.EntityType.DEVICE,
245
+ propertyId: device.propertyId,
246
+ zoneId: device.zoneId,
247
+ title: "Door Left Open - Requires Attention",
248
+ description: `Zone ${zone?.name} has a door left open, for more than 10 minutes. ${reason ? `Reason: ${reason}` : ""}. Please check the zone and close the door.`,
249
+ createdBy: source,
250
+ category: issue_types_1.IssuesCategory.SECURITY,
251
+ priority: issue_types_1.IssuePriority.HIGH,
252
+ });
253
+ }
234
254
  /**
235
255
  * Create issue for device battery level below threshold (READINESS + OPERATIONAL + ENERGY)
236
256
  */
@@ -239,8 +259,9 @@ let IssueService = (() => {
239
259
  entityId: device.deviceId,
240
260
  entityType: issue_types_1.EntityType.DEVICE,
241
261
  propertyId: device.propertyId,
262
+ zoneId: device.zoneId,
242
263
  title: "Device Battery Low - Requires Attention",
243
- description: `Device ${device.name} (${device.deviceId}) battery level is ${batteryLevel}%, which is below the property threshold of ${threshold}%. This requires immediate attention to replace or charge the device battery.`,
264
+ description: `Device ${device.name} (${device.deviceId}) battery level is ${batteryLevel}%, which is below the property threshold of ${threshold}%. Please replace or charge the device battery.`,
244
265
  createdBy: source,
245
266
  category: issue_types_1.IssuesCategory.ENERGY,
246
267
  priority: issue_types_1.IssuePriority.MEDIUM,
@@ -254,6 +275,7 @@ let IssueService = (() => {
254
275
  entityId: device.deviceId,
255
276
  entityType: issue_types_1.EntityType.DEVICE,
256
277
  propertyId: device.propertyId,
278
+ zoneId: device.zoneId,
257
279
  title: `Device Malfunction - ${issueType} - Requires Attention`,
258
280
  description: `Device ${device.name} (${device.deviceId}) has a malfunction: ${issueType}. ${reason ? `Reason: ${reason}` : ""} This requires immediate attention to resolve the device malfunction.`,
259
281
  createdBy: source,
@@ -265,7 +287,7 @@ let IssueService = (() => {
265
287
  * Create a maintenance issue using IssueBuilder
266
288
  */
267
289
  async createMaintenanceIssue(data) {
268
- const issueBuilder = IssueBuilder_1.IssueBuilder.createMaintenanceIssue(data.propertyId, data.entityId, data.entityType)
290
+ const issueBuilder = IssueBuilder_1.IssueBuilder.createMaintenanceIssue(data.propertyId, data.zoneId, data.entityId, data.entityType)
269
291
  .setTitle(data.title)
270
292
  .setDescription(data.description)
271
293
  .setCreatedBy(data.createdBy);
@@ -279,7 +301,7 @@ let IssueService = (() => {
279
301
  * Create an urgent issue using IssueBuilder
280
302
  */
281
303
  async createUrgentIssue(data) {
282
- const issueBuilder = IssueBuilder_1.IssueBuilder.createUrgentIssue(data.propertyId, data.entityId, data.entityType)
304
+ const issueBuilder = IssueBuilder_1.IssueBuilder.createUrgentIssue(data.propertyId, data.zoneId, data.entityId, data.entityType)
283
305
  .setTitle(data.title)
284
306
  .setDescription(data.description)
285
307
  .setCreatedBy(data.createdBy);
@@ -555,8 +577,8 @@ let IssueService = (() => {
555
577
  /**
556
578
  * Get issue statistics with business logic
557
579
  */
558
- async getIssueStatistics(propertyId) {
559
- const stats = await this.issueRepository.getStatistics(propertyId);
580
+ async getIssueStatistics(propertyId, zoneId) {
581
+ const stats = await this.issueRepository.getStatistics(propertyId, zoneId);
560
582
  // Business logic: Calculate additional metrics
561
583
  const responseTime = this.calculateAverageResponseTime(stats);
562
584
  const resolutionRate = this.calculateResolutionRate(stats);
@@ -581,6 +603,36 @@ let IssueService = (() => {
581
603
  }
582
604
  return await this.issueRepository.search(searchTerm, filters);
583
605
  }
606
+ /**
607
+ * Get issues by zone ID
608
+ */
609
+ async getIssuesByZoneId(zoneId, includeDeleted = false) {
610
+ if (!zoneId) {
611
+ throw new Error("Zone ID is required");
612
+ }
613
+ return await this.issueRepository.findByZoneId(zoneId, includeDeleted);
614
+ }
615
+ /**
616
+ * Get issues by zone ID and status
617
+ */
618
+ async getIssuesByZoneIdAndStatus(zoneId, status, includeDeleted = false) {
619
+ if (!zoneId) {
620
+ throw new Error("Zone ID is required");
621
+ }
622
+ if (!status) {
623
+ throw new Error("Status is required");
624
+ }
625
+ return await this.issueRepository.findByZoneIdAndStatus(zoneId, status, includeDeleted);
626
+ }
627
+ /**
628
+ * Get issues by multiple zone IDs
629
+ */
630
+ async getIssuesByZoneIds(zoneIds, includeDeleted = false) {
631
+ if (!zoneIds || zoneIds.length === 0) {
632
+ throw new Error("Zone IDs array is required and cannot be empty");
633
+ }
634
+ return await this.issueRepository.findByZoneIds(zoneIds, includeDeleted);
635
+ }
584
636
  // Private business logic methods
585
637
  validateIssueData(data) {
586
638
  if (!data.title || data.title.trim().length < 5) {
@@ -592,6 +644,9 @@ let IssueService = (() => {
592
644
  if (!data.propertyId) {
593
645
  throw new Error("Property ID is required");
594
646
  }
647
+ if (!data.zoneId) {
648
+ throw new Error("Zone ID is required");
649
+ }
595
650
  if (!data.createdBy) {
596
651
  throw new Error("Created by user ID is required");
597
652
  }
@@ -30,6 +30,10 @@ export declare class IssueBuilder {
30
30
  * Sets the property ID
31
31
  */
32
32
  setPropertyId(propertyId: string): this;
33
+ /**
34
+ * Sets the zone ID
35
+ */
36
+ setZoneId(zoneId: string): this;
33
37
  /**
34
38
  * Sets the issue title
35
39
  */
@@ -85,25 +89,25 @@ export declare class IssueBuilder {
85
89
  /**
86
90
  * Creates a device-specific issue builder
87
91
  */
88
- static createDeviceIssue(deviceId: string, propertyId: string): IssueBuilder;
92
+ static createDeviceIssue(deviceId: string, propertyId: string, zoneId: string): IssueBuilder;
89
93
  /**
90
94
  * Creates a hub-specific issue builder
91
95
  */
92
- static createHubIssue(hubId: string, propertyId: string): IssueBuilder;
96
+ static createHubIssue(hubId: string, propertyId: string, zoneId: string): IssueBuilder;
93
97
  /**
94
98
  * Creates a user-specific issue builder
95
99
  */
96
- static createUserIssue(userId: string, propertyId: string): IssueBuilder;
100
+ static createUserIssue(userId: string, propertyId: string, zoneId: string): IssueBuilder;
97
101
  /**
98
102
  * Creates a property-specific issue builder
99
103
  */
100
- static createPropertyIssue(propertyId: string): IssueBuilder;
104
+ static createPropertyIssue(propertyId: string, zoneId: string): IssueBuilder;
101
105
  /**
102
106
  * Creates a maintenance issue builder
103
107
  */
104
- static createMaintenanceIssue(propertyId: string, entityId?: string, entityType?: EntityType): IssueBuilder;
108
+ static createMaintenanceIssue(propertyId: string, zoneId: string, entityId?: string, entityType?: EntityType): IssueBuilder;
105
109
  /**
106
110
  * Creates an urgent issue builder
107
111
  */
108
- static createUrgentIssue(propertyId: string, entityId?: string, entityType?: EntityType): IssueBuilder;
112
+ static createUrgentIssue(propertyId: string, zoneId: string, entityId?: string, entityType?: EntityType): IssueBuilder;
109
113
  }
@@ -44,6 +44,16 @@ class IssueBuilder {
44
44
  this.data.propertyId = propertyId;
45
45
  return this;
46
46
  }
47
+ /**
48
+ * Sets the zone ID
49
+ */
50
+ setZoneId(zoneId) {
51
+ if (!zoneId || zoneId.trim() === "") {
52
+ throw new Error("Zone ID is required and cannot be empty");
53
+ }
54
+ this.data.zoneId = zoneId;
55
+ return this;
56
+ }
47
57
  /**
48
58
  * Sets the issue title
49
59
  */
@@ -124,6 +134,7 @@ class IssueBuilder {
124
134
  const requiredFields = [
125
135
  "category",
126
136
  "propertyId",
137
+ "zoneId",
127
138
  "title",
128
139
  "description",
129
140
  "entityId",
@@ -180,46 +191,51 @@ class IssueBuilder {
180
191
  /**
181
192
  * Creates a device-specific issue builder
182
193
  */
183
- static createDeviceIssue(deviceId, propertyId) {
194
+ static createDeviceIssue(deviceId, propertyId, zoneId) {
184
195
  return new IssueBuilder()
185
196
  .setEntityType(issue_types_1.EntityType.DEVICE)
186
197
  .setEntityId(deviceId)
187
- .setPropertyId(propertyId);
198
+ .setPropertyId(propertyId)
199
+ .setZoneId(zoneId);
188
200
  }
189
201
  /**
190
202
  * Creates a hub-specific issue builder
191
203
  */
192
- static createHubIssue(hubId, propertyId) {
204
+ static createHubIssue(hubId, propertyId, zoneId) {
193
205
  return new IssueBuilder()
194
206
  .setEntityType(issue_types_1.EntityType.HUB)
195
207
  .setEntityId(hubId)
196
- .setPropertyId(propertyId);
208
+ .setPropertyId(propertyId)
209
+ .setZoneId(zoneId);
197
210
  }
198
211
  /**
199
212
  * Creates a user-specific issue builder
200
213
  */
201
- static createUserIssue(userId, propertyId) {
214
+ static createUserIssue(userId, propertyId, zoneId) {
202
215
  return new IssueBuilder()
203
216
  .setEntityType(issue_types_1.EntityType.USER)
204
217
  .setEntityId(userId)
205
- .setPropertyId(propertyId);
218
+ .setPropertyId(propertyId)
219
+ .setZoneId(zoneId);
206
220
  }
207
221
  /**
208
222
  * Creates a property-specific issue builder
209
223
  */
210
- static createPropertyIssue(propertyId) {
224
+ static createPropertyIssue(propertyId, zoneId) {
211
225
  return new IssueBuilder()
212
226
  .setEntityType(issue_types_1.EntityType.PROPERTY)
213
227
  .setEntityId(propertyId)
214
- .setPropertyId(propertyId);
228
+ .setPropertyId(propertyId)
229
+ .setZoneId(zoneId);
215
230
  }
216
231
  /**
217
232
  * Creates a maintenance issue builder
218
233
  */
219
- static createMaintenanceIssue(propertyId, entityId, entityType) {
234
+ static createMaintenanceIssue(propertyId, zoneId, entityId, entityType) {
220
235
  const builder = new IssueBuilder()
221
236
  .setCategory(issue_types_1.IssuesCategory.READINESS)
222
237
  .setPropertyId(propertyId)
238
+ .setZoneId(zoneId)
223
239
  .setPriority(issue_types_1.IssuePriority.MEDIUM);
224
240
  if (entityId)
225
241
  builder.setEntityId(entityId);
@@ -230,10 +246,11 @@ class IssueBuilder {
230
246
  /**
231
247
  * Creates an urgent issue builder
232
248
  */
233
- static createUrgentIssue(propertyId, entityId, entityType) {
249
+ static createUrgentIssue(propertyId, zoneId, entityId, entityType) {
234
250
  const builder = new IssueBuilder()
235
251
  .setCategory(issue_types_1.IssuesCategory.OPERATIONS)
236
252
  .setPropertyId(propertyId)
253
+ .setZoneId(zoneId)
237
254
  .setPriority(issue_types_1.IssuePriority.URGENT);
238
255
  if (entityId)
239
256
  builder.setEntityId(entityId);
@@ -42,6 +42,7 @@ export interface IssueDocument {
42
42
  _id: string;
43
43
  category: IssuesCategory;
44
44
  propertyId: string;
45
+ zoneId: string;
45
46
  title: string;
46
47
  description: string;
47
48
  entityId?: string;
@@ -61,6 +62,7 @@ export interface IssueDocument {
61
62
  export interface CreateIssueData {
62
63
  category: IssuesCategory;
63
64
  propertyId: string;
65
+ zoneId: string;
64
66
  title: string;
65
67
  description: string;
66
68
  entityId: string;
@@ -90,6 +92,7 @@ export interface AddCommentData {
90
92
  }
91
93
  export interface IIssueQuery {
92
94
  propertyId?: string;
95
+ zoneId?: string;
93
96
  assignedTo?: string;
94
97
  status?: IssueStatus;
95
98
  priority?: IssuePriority;
@@ -34,7 +34,7 @@ function createAxiosInstance(baseURL) {
34
34
  validateStatus: (status) => status < 500, // Don't throw on 4xx errors
35
35
  headers: {
36
36
  "Content-Type": "application/json",
37
- "User-Agent": "dt-common-device/1.3.0",
37
+ "User-Agent": `dt-common-device/${require('../../package.json').version}`,
38
38
  "x-api-key": (0, config_1.getDTApiKey)(),
39
39
  },
40
40
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "6.2.0",
3
+ "version": "7.0.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [