dt-common-device 7.1.4 → 7.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.
- package/dist/entities/device/local/services/Device.service.js +1 -1
- package/dist/issues/Issue.model.js +6 -0
- package/dist/issues/Issue.service.d.ts +1 -1
- package/dist/issues/Issue.service.js +8 -4
- package/dist/issues/IssueBuilder.d.ts +6 -2
- package/dist/issues/IssueBuilder.js +11 -2
- package/dist/issues/issue.types.d.ts +11 -0
- package/dist/issues/issue.types.js +9 -1
- package/package.json +1 -1
|
@@ -402,7 +402,7 @@ let LocalDeviceService = (() => {
|
|
|
402
402
|
// Raise alert for device malfunction (READINESS + OPERATIONAL)
|
|
403
403
|
await this.alertService.raiseDeviceIssueAlert(device, "Device Malfunction Detected", source, reason);
|
|
404
404
|
// Raise issue for device malfunction (READINESS + OPERATIONAL)
|
|
405
|
-
await this.issueService.createDeviceMalfunctionIssue(device,
|
|
405
|
+
await this.issueService.createDeviceMalfunctionIssue(device, source, reason);
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
408
|
async getMetaData(deviceId) {
|
|
@@ -81,6 +81,12 @@ const IssueSchema = new mongoose_1.Schema({
|
|
|
81
81
|
required: true,
|
|
82
82
|
index: true,
|
|
83
83
|
},
|
|
84
|
+
entitySubType: {
|
|
85
|
+
type: String,
|
|
86
|
+
enum: Object.values(issue_types_1.EntitySubType),
|
|
87
|
+
required: true,
|
|
88
|
+
index: true,
|
|
89
|
+
},
|
|
84
90
|
status: {
|
|
85
91
|
type: String,
|
|
86
92
|
enum: Object.values(issue_types_1.IssueStatus),
|
|
@@ -55,7 +55,7 @@ export declare class IssueService {
|
|
|
55
55
|
/**
|
|
56
56
|
* Create issue for device malfunction (jammed or not accepting codes) (READINESS + OPERATIONAL)
|
|
57
57
|
*/
|
|
58
|
-
createDeviceMalfunctionIssue(device: IDevice,
|
|
58
|
+
createDeviceMalfunctionIssue(device: IDevice, source: Source, reason?: string): Promise<IIssueDocument>;
|
|
59
59
|
/**
|
|
60
60
|
* Create a maintenance issue using IssueBuilder
|
|
61
61
|
*/
|
|
@@ -183,7 +183,7 @@ let IssueService = (() => {
|
|
|
183
183
|
* Create a device-specific issue using IssueBuilder
|
|
184
184
|
*/
|
|
185
185
|
async createDeviceIssue(data) {
|
|
186
|
-
const issueBuilder = IssueBuilder_1.IssueBuilder.createDeviceIssue(data.entityId, data.propertyId, data.type)
|
|
186
|
+
const issueBuilder = IssueBuilder_1.IssueBuilder.createDeviceIssue(data.entityId, data.propertyId, data.type, data.entitySubType)
|
|
187
187
|
.setTitle(data.title)
|
|
188
188
|
.setDescription(data.description)
|
|
189
189
|
.setCreatedBy(data.createdBy);
|
|
@@ -253,6 +253,7 @@ let IssueService = (() => {
|
|
|
253
253
|
return await this.createDeviceIssue({
|
|
254
254
|
entityId: device.deviceId,
|
|
255
255
|
entityType: issue_types_1.EntityType.DEVICE,
|
|
256
|
+
entitySubType: device.deviceType.type,
|
|
256
257
|
propertyId: device.propertyId,
|
|
257
258
|
zoneId: device.zoneId,
|
|
258
259
|
title: "Device Offline - Requires Attention",
|
|
@@ -268,6 +269,7 @@ let IssueService = (() => {
|
|
|
268
269
|
return await this.createDeviceIssue({
|
|
269
270
|
entityId: device.deviceId,
|
|
270
271
|
entityType: issue_types_1.EntityType.DEVICE,
|
|
272
|
+
entitySubType: device.deviceType.type,
|
|
271
273
|
propertyId: device.propertyId,
|
|
272
274
|
zoneId: device.zoneId,
|
|
273
275
|
title: "Door Left Open - Requires Attention",
|
|
@@ -285,6 +287,7 @@ let IssueService = (() => {
|
|
|
285
287
|
return await this.createDeviceIssue({
|
|
286
288
|
entityId: device.deviceId,
|
|
287
289
|
entityType: issue_types_1.EntityType.DEVICE,
|
|
290
|
+
entitySubType: device.deviceType.type,
|
|
288
291
|
propertyId: device.propertyId,
|
|
289
292
|
zoneId: device.zoneId,
|
|
290
293
|
title: "Device Battery Low - Requires Attention",
|
|
@@ -298,14 +301,15 @@ let IssueService = (() => {
|
|
|
298
301
|
/**
|
|
299
302
|
* Create issue for device malfunction (jammed or not accepting codes) (READINESS + OPERATIONAL)
|
|
300
303
|
*/
|
|
301
|
-
async createDeviceMalfunctionIssue(device,
|
|
304
|
+
async createDeviceMalfunctionIssue(device, source, reason) {
|
|
302
305
|
return await this.createDeviceIssue({
|
|
303
306
|
entityId: device.deviceId,
|
|
304
307
|
entityType: issue_types_1.EntityType.DEVICE,
|
|
308
|
+
entitySubType: device.deviceType.type,
|
|
305
309
|
propertyId: device.propertyId,
|
|
306
310
|
zoneId: device.zoneId,
|
|
307
|
-
title: `Device Malfunction -
|
|
308
|
-
description: `Device ${device.name} (${device.deviceId}) has a malfunction
|
|
311
|
+
title: `Device Malfunction - Requires Attention`,
|
|
312
|
+
description: `Device ${device.name} (${device.deviceId}) has a malfunction. ${reason ? `Reason: ${reason}` : ""} This requires immediate attention to resolve the device malfunction.`,
|
|
309
313
|
createdBy: source,
|
|
310
314
|
category: issue_types_1.IssuesCategory.OPERATIONS,
|
|
311
315
|
priority: issue_types_1.IssuePriority.HIGH,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateIssueData, IssuesCategory, IssuePriority, EntityType, IssueType } from "./issue.types";
|
|
1
|
+
import { CreateIssueData, IssuesCategory, IssuePriority, EntityType, IssueType, EntitySubType } from "./issue.types";
|
|
2
2
|
/**
|
|
3
3
|
* IssueBuilder - A builder pattern implementation for constructing CreateIssueData objects
|
|
4
4
|
*
|
|
@@ -54,6 +54,10 @@ export declare class IssueBuilder {
|
|
|
54
54
|
* Sets the entity type
|
|
55
55
|
*/
|
|
56
56
|
setEntityType(entityType: EntityType): this;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the entity sub type
|
|
59
|
+
*/
|
|
60
|
+
setEntitySubType(entitySubType: EntitySubType): this;
|
|
57
61
|
/**
|
|
58
62
|
* Sets the issue priority (optional, defaults to LOW)
|
|
59
63
|
*/
|
|
@@ -93,7 +97,7 @@ export declare class IssueBuilder {
|
|
|
93
97
|
/**
|
|
94
98
|
* Creates a device-specific issue builder
|
|
95
99
|
*/
|
|
96
|
-
static createDeviceIssue(deviceId: string, propertyId: string, type: IssueType): IssueBuilder;
|
|
100
|
+
static createDeviceIssue(deviceId: string, propertyId: string, type: IssueType, entitySubType: EntitySubType): IssueBuilder;
|
|
97
101
|
/**
|
|
98
102
|
* Creates a hub-specific issue builder
|
|
99
103
|
*/
|
|
@@ -99,6 +99,13 @@ class IssueBuilder {
|
|
|
99
99
|
this.data.entityType = entityType;
|
|
100
100
|
return this;
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Sets the entity sub type
|
|
104
|
+
*/
|
|
105
|
+
setEntitySubType(entitySubType) {
|
|
106
|
+
this.data.entitySubType = entitySubType;
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
102
109
|
/**
|
|
103
110
|
* Sets the issue priority (optional, defaults to LOW)
|
|
104
111
|
*/
|
|
@@ -148,6 +155,7 @@ class IssueBuilder {
|
|
|
148
155
|
"description",
|
|
149
156
|
"entityId",
|
|
150
157
|
"entityType",
|
|
158
|
+
"entitySubType",
|
|
151
159
|
"createdBy",
|
|
152
160
|
];
|
|
153
161
|
const missingFields = requiredFields.filter((field) => !this.data[field]);
|
|
@@ -200,12 +208,13 @@ class IssueBuilder {
|
|
|
200
208
|
/**
|
|
201
209
|
* Creates a device-specific issue builder
|
|
202
210
|
*/
|
|
203
|
-
static createDeviceIssue(deviceId, propertyId, type) {
|
|
211
|
+
static createDeviceIssue(deviceId, propertyId, type, entitySubType) {
|
|
204
212
|
const builder = new IssueBuilder()
|
|
205
213
|
.setEntityType(issue_types_1.EntityType.DEVICE)
|
|
206
214
|
.setEntityId(deviceId)
|
|
207
215
|
.setPropertyId(propertyId)
|
|
208
|
-
.setType(type)
|
|
216
|
+
.setType(type)
|
|
217
|
+
.setEntitySubType(entitySubType);
|
|
209
218
|
return builder;
|
|
210
219
|
}
|
|
211
220
|
/**
|
|
@@ -18,6 +18,13 @@ export declare enum EntityType {
|
|
|
18
18
|
CLOUD_DEVICE_ACCOUNT = "CLOUD_DEVICE_ACCOUNT",
|
|
19
19
|
CLOUD_PMS_ACCOUNT = "CLOUD_PMS_ACCOUNT"
|
|
20
20
|
}
|
|
21
|
+
export declare enum EntitySubType {
|
|
22
|
+
LOCK = "LOCK",
|
|
23
|
+
HUB = "HUB",
|
|
24
|
+
TV = "TV",
|
|
25
|
+
THERMOSTAT = "THERMOSTAT",
|
|
26
|
+
ON_PREM_SERVER = "ON_PREM_SERVER"
|
|
27
|
+
}
|
|
21
28
|
export declare enum IssueStatus {
|
|
22
29
|
PENDING = "PENDING",
|
|
23
30
|
IN_PROGRESS = "IN_PROGRESS",
|
|
@@ -66,6 +73,7 @@ export interface IssueDocument {
|
|
|
66
73
|
description: string;
|
|
67
74
|
entityId?: string;
|
|
68
75
|
entityType: EntityType;
|
|
76
|
+
entitySubType: EntitySubType;
|
|
69
77
|
status: IssueStatus;
|
|
70
78
|
priority: IssuePriority;
|
|
71
79
|
type: IssueType;
|
|
@@ -87,6 +95,7 @@ export interface CreateIssueData {
|
|
|
87
95
|
description: string;
|
|
88
96
|
entityId: string;
|
|
89
97
|
entityType: EntityType;
|
|
98
|
+
entitySubType: EntitySubType;
|
|
90
99
|
type: IssueType;
|
|
91
100
|
priority?: IssuePriority;
|
|
92
101
|
assignedTo?: string;
|
|
@@ -99,6 +108,7 @@ export interface UpdateIssueData {
|
|
|
99
108
|
description?: string;
|
|
100
109
|
entityId?: string;
|
|
101
110
|
entityType?: EntityType;
|
|
111
|
+
entitySubType?: EntitySubType;
|
|
102
112
|
status?: IssueStatus;
|
|
103
113
|
type?: IssueType;
|
|
104
114
|
priority?: IssuePriority;
|
|
@@ -121,6 +131,7 @@ export interface IIssueQuery {
|
|
|
121
131
|
type?: IssueType;
|
|
122
132
|
category?: IssuesCategory;
|
|
123
133
|
entityType?: EntityType;
|
|
134
|
+
entitySubType?: EntitySubType;
|
|
124
135
|
entityId?: string;
|
|
125
136
|
includeDeleted?: boolean;
|
|
126
137
|
limit?: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IssueType = exports.IssuePriority = exports.IssueStatus = exports.EntityType = exports.IssuesCategory = void 0;
|
|
3
|
+
exports.IssueType = exports.IssuePriority = exports.IssueStatus = exports.EntitySubType = exports.EntityType = exports.IssuesCategory = void 0;
|
|
4
4
|
var IssuesCategory;
|
|
5
5
|
(function (IssuesCategory) {
|
|
6
6
|
IssuesCategory["READINESS"] = "READINESS";
|
|
@@ -23,6 +23,14 @@ var EntityType;
|
|
|
23
23
|
EntityType["CLOUD_DEVICE_ACCOUNT"] = "CLOUD_DEVICE_ACCOUNT";
|
|
24
24
|
EntityType["CLOUD_PMS_ACCOUNT"] = "CLOUD_PMS_ACCOUNT";
|
|
25
25
|
})(EntityType || (exports.EntityType = EntityType = {}));
|
|
26
|
+
var EntitySubType;
|
|
27
|
+
(function (EntitySubType) {
|
|
28
|
+
EntitySubType["LOCK"] = "LOCK";
|
|
29
|
+
EntitySubType["HUB"] = "HUB";
|
|
30
|
+
EntitySubType["TV"] = "TV";
|
|
31
|
+
EntitySubType["THERMOSTAT"] = "THERMOSTAT";
|
|
32
|
+
EntitySubType["ON_PREM_SERVER"] = "ON_PREM_SERVER";
|
|
33
|
+
})(EntitySubType || (exports.EntitySubType = EntitySubType = {}));
|
|
26
34
|
var IssueStatus;
|
|
27
35
|
(function (IssueStatus) {
|
|
28
36
|
IssueStatus["PENDING"] = "PENDING";
|