dt-common-device 7.1.2 → 7.1.3
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IIssueDocument } from "./Issue.model";
|
|
2
|
-
import { CreateIssueData, UpdateIssueData, AddCommentData, IssuePriority, IssuesCategory, EntityType, IIssueQuery } from "./issue.types";
|
|
2
|
+
import { CreateIssueData, UpdateIssueData, AddCommentData, IssuePriority, IssuesCategory, EntityType, IIssueQuery, IssueType } from "./issue.types";
|
|
3
3
|
import { IssueBuilder } from "./IssueBuilder";
|
|
4
4
|
import { Source } from "../constants/Service";
|
|
5
5
|
import { IDevice } from "../entities/device/local/interfaces";
|
|
@@ -41,6 +41,7 @@ export declare class IssueService {
|
|
|
41
41
|
title: string;
|
|
42
42
|
description: string;
|
|
43
43
|
createdBy: string;
|
|
44
|
+
type: IssueType;
|
|
44
45
|
}): Promise<IIssueDocument>;
|
|
45
46
|
/**
|
|
46
47
|
* Create issue for device going offline longer than baseline
|
|
@@ -93,7 +93,6 @@ let IssueService = (() => {
|
|
|
93
93
|
async createReadinessIssue(data) {
|
|
94
94
|
const issueBuilder = IssueBuilder_1.IssueBuilder.createReadinessIssue()
|
|
95
95
|
.setPropertyId(data.propertyId)
|
|
96
|
-
.setZoneId(data.zoneId)
|
|
97
96
|
.setTitle(data.title)
|
|
98
97
|
.setDescription(data.description)
|
|
99
98
|
.setCreatedBy(data.createdBy);
|
|
@@ -105,6 +104,10 @@ let IssueService = (() => {
|
|
|
105
104
|
issueBuilder.setAssignedTo(data.assignedTo);
|
|
106
105
|
if (data.dueDate)
|
|
107
106
|
issueBuilder.setDueDate(data.dueDate);
|
|
107
|
+
if (data.zoneId)
|
|
108
|
+
issueBuilder.setZoneId(data.zoneId);
|
|
109
|
+
if (data.type)
|
|
110
|
+
issueBuilder.setType(data.type);
|
|
108
111
|
return await this.createIssue(issueBuilder);
|
|
109
112
|
}
|
|
110
113
|
/**
|
|
@@ -113,7 +116,6 @@ let IssueService = (() => {
|
|
|
113
116
|
async createOperationsIssue(data) {
|
|
114
117
|
const issueBuilder = IssueBuilder_1.IssueBuilder.createOperationsIssue()
|
|
115
118
|
.setPropertyId(data.propertyId)
|
|
116
|
-
.setZoneId(data.zoneId)
|
|
117
119
|
.setTitle(data.title)
|
|
118
120
|
.setDescription(data.description)
|
|
119
121
|
.setCreatedBy(data.createdBy);
|
|
@@ -125,6 +127,10 @@ let IssueService = (() => {
|
|
|
125
127
|
issueBuilder.setAssignedTo(data.assignedTo);
|
|
126
128
|
if (data.dueDate)
|
|
127
129
|
issueBuilder.setDueDate(data.dueDate);
|
|
130
|
+
if (data.zoneId)
|
|
131
|
+
issueBuilder.setZoneId(data.zoneId);
|
|
132
|
+
if (data.type)
|
|
133
|
+
issueBuilder.setType(data.type);
|
|
128
134
|
return await this.createIssue(issueBuilder);
|
|
129
135
|
}
|
|
130
136
|
/**
|
|
@@ -133,7 +139,6 @@ let IssueService = (() => {
|
|
|
133
139
|
async createSecurityIssue(data) {
|
|
134
140
|
const issueBuilder = IssueBuilder_1.IssueBuilder.createSecurityIssue()
|
|
135
141
|
.setPropertyId(data.propertyId)
|
|
136
|
-
.setZoneId(data.zoneId)
|
|
137
142
|
.setTitle(data.title)
|
|
138
143
|
.setDescription(data.description)
|
|
139
144
|
.setCreatedBy(data.createdBy);
|
|
@@ -145,6 +150,10 @@ let IssueService = (() => {
|
|
|
145
150
|
issueBuilder.setAssignedTo(data.assignedTo);
|
|
146
151
|
if (data.dueDate)
|
|
147
152
|
issueBuilder.setDueDate(data.dueDate);
|
|
153
|
+
if (data.zoneId)
|
|
154
|
+
issueBuilder.setZoneId(data.zoneId);
|
|
155
|
+
if (data.type)
|
|
156
|
+
issueBuilder.setType(data.type);
|
|
148
157
|
return await this.createIssue(issueBuilder);
|
|
149
158
|
}
|
|
150
159
|
/**
|
|
@@ -153,7 +162,6 @@ let IssueService = (() => {
|
|
|
153
162
|
async createEnergyIssue(data) {
|
|
154
163
|
const issueBuilder = IssueBuilder_1.IssueBuilder.createEnergyIssue()
|
|
155
164
|
.setPropertyId(data.propertyId)
|
|
156
|
-
.setZoneId(data.zoneId)
|
|
157
165
|
.setTitle(data.title)
|
|
158
166
|
.setDescription(data.description)
|
|
159
167
|
.setCreatedBy(data.createdBy);
|
|
@@ -165,13 +173,17 @@ let IssueService = (() => {
|
|
|
165
173
|
issueBuilder.setAssignedTo(data.assignedTo);
|
|
166
174
|
if (data.dueDate)
|
|
167
175
|
issueBuilder.setDueDate(data.dueDate);
|
|
176
|
+
if (data.type)
|
|
177
|
+
issueBuilder.setType(data.type);
|
|
178
|
+
if (data.zoneId)
|
|
179
|
+
issueBuilder.setZoneId(data.zoneId);
|
|
168
180
|
return await this.createIssue(issueBuilder);
|
|
169
181
|
}
|
|
170
182
|
/**
|
|
171
183
|
* Create a device-specific issue using IssueBuilder
|
|
172
184
|
*/
|
|
173
185
|
async createDeviceIssue(data) {
|
|
174
|
-
const issueBuilder = IssueBuilder_1.IssueBuilder.createDeviceIssue(data.entityId, data.propertyId, data.
|
|
186
|
+
const issueBuilder = IssueBuilder_1.IssueBuilder.createDeviceIssue(data.entityId, data.propertyId, data.type)
|
|
175
187
|
.setTitle(data.title)
|
|
176
188
|
.setDescription(data.description)
|
|
177
189
|
.setCreatedBy(data.createdBy);
|
|
@@ -183,13 +195,15 @@ let IssueService = (() => {
|
|
|
183
195
|
issueBuilder.setAssignedTo(data.assignedTo);
|
|
184
196
|
if (data.dueDate)
|
|
185
197
|
issueBuilder.setDueDate(data.dueDate);
|
|
198
|
+
if (data.zoneId)
|
|
199
|
+
issueBuilder.setZoneId(data.zoneId);
|
|
186
200
|
return await this.createIssue(issueBuilder);
|
|
187
201
|
}
|
|
188
202
|
/**
|
|
189
203
|
* Create a hub-specific issue using IssueBuilder
|
|
190
204
|
*/
|
|
191
205
|
async createHubIssue(data) {
|
|
192
|
-
const issueBuilder = IssueBuilder_1.IssueBuilder.createHubIssue(data.entityId, data.propertyId, data.
|
|
206
|
+
const issueBuilder = IssueBuilder_1.IssueBuilder.createHubIssue(data.entityId, data.propertyId, data.type)
|
|
193
207
|
.setTitle(data.title)
|
|
194
208
|
.setDescription(data.description)
|
|
195
209
|
.setCreatedBy(data.createdBy);
|
|
@@ -201,13 +215,15 @@ let IssueService = (() => {
|
|
|
201
215
|
issueBuilder.setAssignedTo(data.assignedTo);
|
|
202
216
|
if (data.dueDate)
|
|
203
217
|
issueBuilder.setDueDate(data.dueDate);
|
|
218
|
+
if (data.zoneId)
|
|
219
|
+
issueBuilder.setZoneId(data.zoneId);
|
|
204
220
|
return await this.createIssue(issueBuilder);
|
|
205
221
|
}
|
|
206
222
|
/**
|
|
207
223
|
* Create a user-specific issue using IssueBuilder
|
|
208
224
|
*/
|
|
209
225
|
async createUserIssue(data) {
|
|
210
|
-
const issueBuilder = IssueBuilder_1.IssueBuilder.createUserIssue(data.entityId, data.propertyId, data.
|
|
226
|
+
const issueBuilder = IssueBuilder_1.IssueBuilder.createUserIssue(data.entityId, data.propertyId, data.type)
|
|
211
227
|
.setTitle(data.title)
|
|
212
228
|
.setDescription(data.description)
|
|
213
229
|
.setCreatedBy(data.createdBy);
|
|
@@ -219,10 +235,12 @@ let IssueService = (() => {
|
|
|
219
235
|
issueBuilder.setAssignedTo(data.assignedTo);
|
|
220
236
|
if (data.dueDate)
|
|
221
237
|
issueBuilder.setDueDate(data.dueDate);
|
|
238
|
+
if (data.zoneId)
|
|
239
|
+
issueBuilder.setZoneId(data.zoneId);
|
|
222
240
|
return await this.createIssue(issueBuilder);
|
|
223
241
|
}
|
|
224
242
|
async createCloudAccountAuthorizationIssue(data) {
|
|
225
|
-
const issueBuilder = IssueBuilder_1.IssueBuilder.createCloudAccountAuthorizationIssue(data.propertyId, data.entityId, data.entityType)
|
|
243
|
+
const issueBuilder = IssueBuilder_1.IssueBuilder.createCloudAccountAuthorizationIssue(data.propertyId, data.entityId, data.entityType, data.type)
|
|
226
244
|
.setTitle(data.title)
|
|
227
245
|
.setDescription(data.description)
|
|
228
246
|
.setCreatedBy(data.createdBy);
|
|
@@ -298,7 +316,7 @@ let IssueService = (() => {
|
|
|
298
316
|
* Create a maintenance issue using IssueBuilder
|
|
299
317
|
*/
|
|
300
318
|
async createMaintenanceIssue(data) {
|
|
301
|
-
const issueBuilder = IssueBuilder_1.IssueBuilder.createMaintenanceIssue(data.propertyId, data.
|
|
319
|
+
const issueBuilder = IssueBuilder_1.IssueBuilder.createMaintenanceIssue(data.propertyId, data.type, data.entityId, data.entityType)
|
|
302
320
|
.setTitle(data.title)
|
|
303
321
|
.setDescription(data.description)
|
|
304
322
|
.setCreatedBy(data.createdBy);
|
|
@@ -306,13 +324,15 @@ let IssueService = (() => {
|
|
|
306
324
|
issueBuilder.setAssignedTo(data.assignedTo);
|
|
307
325
|
if (data.dueDate)
|
|
308
326
|
issueBuilder.setDueDate(data.dueDate);
|
|
327
|
+
if (data.zoneId)
|
|
328
|
+
issueBuilder.setZoneId(data.zoneId);
|
|
309
329
|
return await this.createIssue(issueBuilder);
|
|
310
330
|
}
|
|
311
331
|
/**
|
|
312
332
|
* Create an urgent issue using IssueBuilder
|
|
313
333
|
*/
|
|
314
334
|
async createUrgentIssue(data) {
|
|
315
|
-
const issueBuilder = IssueBuilder_1.IssueBuilder.createUrgentIssue(data.propertyId, data.
|
|
335
|
+
const issueBuilder = IssueBuilder_1.IssueBuilder.createUrgentIssue(data.propertyId, data.type, data.entityId, data.entityType)
|
|
316
336
|
.setTitle(data.title)
|
|
317
337
|
.setDescription(data.description)
|
|
318
338
|
.setCreatedBy(data.createdBy);
|
|
@@ -320,6 +340,8 @@ let IssueService = (() => {
|
|
|
320
340
|
issueBuilder.setAssignedTo(data.assignedTo);
|
|
321
341
|
if (data.dueDate)
|
|
322
342
|
issueBuilder.setDueDate(data.dueDate);
|
|
343
|
+
if (data.zoneId)
|
|
344
|
+
issueBuilder.setZoneId(data.zoneId);
|
|
323
345
|
return await this.createIssue(issueBuilder);
|
|
324
346
|
}
|
|
325
347
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateIssueData, IssuesCategory, IssuePriority, EntityType } from "./issue.types";
|
|
1
|
+
import { CreateIssueData, IssuesCategory, IssuePriority, EntityType, IssueType } from "./issue.types";
|
|
2
2
|
/**
|
|
3
3
|
* IssueBuilder - A builder pattern implementation for constructing CreateIssueData objects
|
|
4
4
|
*
|
|
@@ -34,6 +34,10 @@ export declare class IssueBuilder {
|
|
|
34
34
|
* Sets the zone ID (optional)
|
|
35
35
|
*/
|
|
36
36
|
setZoneId(zoneId?: string): this;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the issue type
|
|
39
|
+
*/
|
|
40
|
+
setType(type: IssueType): this;
|
|
37
41
|
/**
|
|
38
42
|
* Sets the issue title
|
|
39
43
|
*/
|
|
@@ -89,26 +93,26 @@ export declare class IssueBuilder {
|
|
|
89
93
|
/**
|
|
90
94
|
* Creates a device-specific issue builder
|
|
91
95
|
*/
|
|
92
|
-
static createDeviceIssue(deviceId: string, propertyId: string,
|
|
96
|
+
static createDeviceIssue(deviceId: string, propertyId: string, type: IssueType): IssueBuilder;
|
|
93
97
|
/**
|
|
94
98
|
* Creates a hub-specific issue builder
|
|
95
99
|
*/
|
|
96
|
-
static createHubIssue(hubId: string, propertyId: string,
|
|
100
|
+
static createHubIssue(hubId: string, propertyId: string, type: IssueType): IssueBuilder;
|
|
97
101
|
/**
|
|
98
102
|
* Creates a user-specific issue builder
|
|
99
103
|
*/
|
|
100
|
-
static createUserIssue(userId: string, propertyId: string,
|
|
104
|
+
static createUserIssue(userId: string, propertyId: string, type: IssueType): IssueBuilder;
|
|
101
105
|
/**
|
|
102
106
|
* Creates a property-specific issue builder
|
|
103
107
|
*/
|
|
104
|
-
static createPropertyIssue(propertyId: string,
|
|
108
|
+
static createPropertyIssue(propertyId: string, type: IssueType): IssueBuilder;
|
|
105
109
|
/**
|
|
106
110
|
* Creates a maintenance issue builder
|
|
107
111
|
*/
|
|
108
|
-
static createMaintenanceIssue(propertyId: string,
|
|
112
|
+
static createMaintenanceIssue(propertyId: string, type: IssueType, entityId?: string, entityType?: EntityType): IssueBuilder;
|
|
109
113
|
/**
|
|
110
114
|
* Creates an urgent issue builder
|
|
111
115
|
*/
|
|
112
|
-
static createUrgentIssue(propertyId: string,
|
|
113
|
-
static createCloudAccountAuthorizationIssue(propertyId: string, entityId: string, entityType: EntityType): IssueBuilder;
|
|
116
|
+
static createUrgentIssue(propertyId: string, type: IssueType, entityId?: string, entityType?: EntityType): IssueBuilder;
|
|
117
|
+
static createCloudAccountAuthorizationIssue(propertyId: string, entityId: string, entityType: EntityType, type: IssueType): IssueBuilder;
|
|
114
118
|
}
|
|
@@ -56,6 +56,13 @@ class IssueBuilder {
|
|
|
56
56
|
}
|
|
57
57
|
return this;
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Sets the issue type
|
|
61
|
+
*/
|
|
62
|
+
setType(type) {
|
|
63
|
+
this.data.type = type;
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
59
66
|
/**
|
|
60
67
|
* Sets the issue title
|
|
61
68
|
*/
|
|
@@ -137,6 +144,7 @@ class IssueBuilder {
|
|
|
137
144
|
"category",
|
|
138
145
|
"propertyId",
|
|
139
146
|
"title",
|
|
147
|
+
"type",
|
|
140
148
|
"description",
|
|
141
149
|
"entityId",
|
|
142
150
|
"entityType",
|
|
@@ -192,87 +200,82 @@ class IssueBuilder {
|
|
|
192
200
|
/**
|
|
193
201
|
* Creates a device-specific issue builder
|
|
194
202
|
*/
|
|
195
|
-
static createDeviceIssue(deviceId, propertyId,
|
|
203
|
+
static createDeviceIssue(deviceId, propertyId, type) {
|
|
196
204
|
const builder = new IssueBuilder()
|
|
197
205
|
.setEntityType(issue_types_1.EntityType.DEVICE)
|
|
198
206
|
.setEntityId(deviceId)
|
|
199
|
-
.setPropertyId(propertyId)
|
|
200
|
-
|
|
201
|
-
builder.setZoneId(zoneId);
|
|
207
|
+
.setPropertyId(propertyId)
|
|
208
|
+
.setType(type);
|
|
202
209
|
return builder;
|
|
203
210
|
}
|
|
204
211
|
/**
|
|
205
212
|
* Creates a hub-specific issue builder
|
|
206
213
|
*/
|
|
207
|
-
static createHubIssue(hubId, propertyId,
|
|
214
|
+
static createHubIssue(hubId, propertyId, type) {
|
|
208
215
|
const builder = new IssueBuilder()
|
|
209
216
|
.setEntityType(issue_types_1.EntityType.HUB)
|
|
210
217
|
.setEntityId(hubId)
|
|
211
|
-
.setPropertyId(propertyId)
|
|
212
|
-
|
|
213
|
-
builder.setZoneId(zoneId);
|
|
218
|
+
.setPropertyId(propertyId)
|
|
219
|
+
.setType(type);
|
|
214
220
|
return builder;
|
|
215
221
|
}
|
|
216
222
|
/**
|
|
217
223
|
* Creates a user-specific issue builder
|
|
218
224
|
*/
|
|
219
|
-
static createUserIssue(userId, propertyId,
|
|
225
|
+
static createUserIssue(userId, propertyId, type) {
|
|
220
226
|
const builder = new IssueBuilder()
|
|
221
227
|
.setEntityType(issue_types_1.EntityType.USER)
|
|
222
228
|
.setEntityId(userId)
|
|
223
|
-
.setPropertyId(propertyId)
|
|
224
|
-
|
|
225
|
-
builder.setZoneId(zoneId);
|
|
229
|
+
.setPropertyId(propertyId)
|
|
230
|
+
.setType(type);
|
|
226
231
|
return builder;
|
|
227
232
|
}
|
|
228
233
|
/**
|
|
229
234
|
* Creates a property-specific issue builder
|
|
230
235
|
*/
|
|
231
|
-
static createPropertyIssue(propertyId,
|
|
236
|
+
static createPropertyIssue(propertyId, type) {
|
|
232
237
|
const builder = new IssueBuilder()
|
|
233
238
|
.setEntityType(issue_types_1.EntityType.PROPERTY)
|
|
234
239
|
.setEntityId(propertyId)
|
|
235
|
-
.setPropertyId(propertyId)
|
|
236
|
-
|
|
237
|
-
builder.setZoneId(zoneId);
|
|
240
|
+
.setPropertyId(propertyId)
|
|
241
|
+
.setType(type);
|
|
238
242
|
return builder;
|
|
239
243
|
}
|
|
240
244
|
/**
|
|
241
245
|
* Creates a maintenance issue builder
|
|
242
246
|
*/
|
|
243
|
-
static createMaintenanceIssue(propertyId,
|
|
247
|
+
static createMaintenanceIssue(propertyId, type, entityId, entityType) {
|
|
244
248
|
const builder = new IssueBuilder()
|
|
245
249
|
.setCategory(issue_types_1.IssuesCategory.READINESS)
|
|
246
|
-
.setPropertyId(propertyId)
|
|
250
|
+
.setPropertyId(propertyId)
|
|
251
|
+
.setType(type);
|
|
247
252
|
if (entityId)
|
|
248
253
|
builder.setEntityId(entityId);
|
|
249
254
|
if (entityType)
|
|
250
255
|
builder.setEntityType(entityType);
|
|
251
|
-
if (zoneId)
|
|
252
|
-
builder.setZoneId(zoneId);
|
|
253
256
|
return builder;
|
|
254
257
|
}
|
|
255
258
|
/**
|
|
256
259
|
* Creates an urgent issue builder
|
|
257
260
|
*/
|
|
258
|
-
static createUrgentIssue(propertyId,
|
|
261
|
+
static createUrgentIssue(propertyId, type, entityId, entityType) {
|
|
259
262
|
const builder = new IssueBuilder()
|
|
260
263
|
.setCategory(issue_types_1.IssuesCategory.OPERATIONS)
|
|
261
264
|
.setPropertyId(propertyId)
|
|
265
|
+
.setType(type)
|
|
262
266
|
.setPriority(issue_types_1.IssuePriority.URGENT);
|
|
263
267
|
if (entityId)
|
|
264
268
|
builder.setEntityId(entityId);
|
|
265
269
|
if (entityType)
|
|
266
270
|
builder.setEntityType(entityType);
|
|
267
|
-
if (zoneId)
|
|
268
|
-
builder.setZoneId(zoneId);
|
|
269
271
|
return builder;
|
|
270
272
|
}
|
|
271
|
-
static createCloudAccountAuthorizationIssue(propertyId, entityId, entityType) {
|
|
273
|
+
static createCloudAccountAuthorizationIssue(propertyId, entityId, entityType, type) {
|
|
272
274
|
const builder = new IssueBuilder()
|
|
273
275
|
.setEntityType(entityType)
|
|
274
276
|
.setEntityId(entityId)
|
|
275
|
-
.setPropertyId(propertyId)
|
|
277
|
+
.setPropertyId(propertyId)
|
|
278
|
+
.setType(type);
|
|
276
279
|
return builder;
|
|
277
280
|
}
|
|
278
281
|
}
|