dt-common-device 5.1.7 → 6.1.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.
- package/dist/alerts/Alert.model.d.ts +1 -6
- package/dist/alerts/Alert.model.js +1 -35
- package/dist/alerts/Alert.repository.d.ts +4 -46
- package/dist/alerts/Alert.repository.js +29 -102
- package/dist/alerts/Alert.service.d.ts +3 -35
- package/dist/alerts/Alert.service.js +39 -54
- package/dist/alerts/AlertBuilder.d.ts +10 -10
- package/dist/alerts/AlertBuilder.js +1 -0
- package/dist/alerts/alert.types.d.ts +15 -0
- package/dist/audit/AuditUtils.js +7 -10
- package/dist/config/config.js +5 -0
- package/dist/config/config.types.d.ts +1 -1
- package/dist/config/constants.d.ts +9 -0
- package/dist/config/constants.js +9 -0
- package/dist/constants/Event.d.ts +12 -0
- package/dist/constants/Event.js +12 -0
- package/dist/entities/admin/Admin.repository.d.ts +4 -0
- package/dist/entities/admin/Admin.repository.js +31 -0
- package/dist/entities/admin/Admin.service.d.ts +4 -0
- package/dist/entities/admin/Admin.service.js +124 -14
- package/dist/entities/admin/IAdmin.d.ts +39 -0
- package/dist/entities/admin/IAdmin.js +2 -0
- package/dist/entities/admin/index.d.ts +1 -0
- package/dist/entities/admin/index.js +1 -0
- package/dist/entities/device/local/interfaces/IDevice.d.ts +12 -0
- package/dist/entities/device/local/services/Device.service.d.ts +3 -4
- package/dist/entities/device/local/services/Device.service.js +59 -9
- package/dist/entities/pms/IPms.d.ts +26 -0
- package/dist/entities/pms/index.d.ts +1 -0
- package/dist/entities/pms/index.js +1 -0
- package/dist/entities/pms/pms.repository.d.ts +8 -0
- package/dist/entities/pms/pms.repository.js +98 -0
- package/dist/entities/pms/pms.service.d.ts +8 -0
- package/dist/entities/pms/pms.service.js +124 -0
- package/dist/events/BaseEventHandler.d.ts +2 -2
- package/dist/events/BaseEventHandler.js +21 -10
- package/dist/issues/Issue.model.d.ts +1 -5
- package/dist/issues/Issue.model.js +0 -28
- package/dist/issues/Issue.repository.d.ts +4 -42
- package/dist/issues/Issue.repository.js +29 -79
- package/dist/issues/Issue.service.d.ts +12 -40
- package/dist/issues/Issue.service.js +179 -145
- package/dist/issues/IssueBuilder.d.ts +11 -11
- package/dist/issues/IssueBuilder.js +10 -2
- package/dist/issues/IssueService.example.js +128 -15
- package/dist/issues/index.d.ts +1 -0
- package/dist/issues/index.js +1 -0
- package/dist/issues/issue.types.d.ts +17 -2
- package/package.json +1 -1
|
@@ -36,13 +36,53 @@ class IssueServiceExample {
|
|
|
36
36
|
*/
|
|
37
37
|
async createSpecificIssues() {
|
|
38
38
|
// Create a readiness issue
|
|
39
|
-
const readinessIssue = await this.issueService.createReadinessIssue(
|
|
39
|
+
const readinessIssue = await this.issueService.createReadinessIssue({
|
|
40
|
+
propertyId: "prop123",
|
|
41
|
+
title: "System Maintenance Required",
|
|
42
|
+
description: "System maintenance is scheduled for tonight",
|
|
43
|
+
createdBy: "admin",
|
|
44
|
+
entityId: "system456",
|
|
45
|
+
entityType: issue_types_1.EntityType.PROPERTY,
|
|
46
|
+
assignedTo: "maintenance-team",
|
|
47
|
+
dueDate: new Date("2024-01-20"),
|
|
48
|
+
category: issue_types_1.IssuesCategory.READINESS,
|
|
49
|
+
});
|
|
40
50
|
// Create an operations issue
|
|
41
|
-
const operationsIssue = await this.issueService.createOperationsIssue(
|
|
51
|
+
const operationsIssue = await this.issueService.createOperationsIssue({
|
|
52
|
+
propertyId: "prop123",
|
|
53
|
+
title: "Device Temperature High",
|
|
54
|
+
description: "Device temperature exceeds normal operating range",
|
|
55
|
+
createdBy: "monitor",
|
|
56
|
+
entityId: "device789",
|
|
57
|
+
entityType: issue_types_1.EntityType.DEVICE,
|
|
58
|
+
assignedTo: "tech-support",
|
|
59
|
+
dueDate: new Date("2024-01-10"),
|
|
60
|
+
category: issue_types_1.IssuesCategory.OPERATIONS,
|
|
61
|
+
});
|
|
42
62
|
// Create a security issue
|
|
43
|
-
const securityIssue = await this.issueService.createSecurityIssue(
|
|
63
|
+
const securityIssue = await this.issueService.createSecurityIssue({
|
|
64
|
+
propertyId: "prop123",
|
|
65
|
+
title: "Unauthorized Access Attempt",
|
|
66
|
+
description: "Multiple failed login attempts detected",
|
|
67
|
+
createdBy: "security-system",
|
|
68
|
+
entityId: "user123",
|
|
69
|
+
entityType: issue_types_1.EntityType.USER,
|
|
70
|
+
assignedTo: "security-team",
|
|
71
|
+
dueDate: new Date("2024-01-05"),
|
|
72
|
+
category: issue_types_1.IssuesCategory.SECURITY,
|
|
73
|
+
});
|
|
44
74
|
// Create an energy issue
|
|
45
|
-
const energyIssue = await this.issueService.createEnergyIssue(
|
|
75
|
+
const energyIssue = await this.issueService.createEnergyIssue({
|
|
76
|
+
propertyId: "prop123",
|
|
77
|
+
title: "High Energy Consumption",
|
|
78
|
+
description: "Energy usage is 20% above normal levels",
|
|
79
|
+
createdBy: "energy-monitor",
|
|
80
|
+
entityId: "zone456",
|
|
81
|
+
entityType: issue_types_1.EntityType.COLLECTION,
|
|
82
|
+
assignedTo: "energy-manager",
|
|
83
|
+
dueDate: new Date("2024-01-25"),
|
|
84
|
+
category: issue_types_1.IssuesCategory.ENERGY,
|
|
85
|
+
});
|
|
46
86
|
return { readinessIssue, operationsIssue, securityIssue, energyIssue };
|
|
47
87
|
}
|
|
48
88
|
/**
|
|
@@ -50,11 +90,31 @@ class IssueServiceExample {
|
|
|
50
90
|
*/
|
|
51
91
|
async createDeviceIssues() {
|
|
52
92
|
// Create a device issue with default category and priority
|
|
53
|
-
const deviceIssue1 = await this.issueService.createDeviceIssue(
|
|
54
|
-
|
|
55
|
-
|
|
93
|
+
const deviceIssue1 = await this.issueService.createDeviceIssue({
|
|
94
|
+
entityId: "device123",
|
|
95
|
+
propertyId: "prop456",
|
|
96
|
+
title: "Device Battery Low",
|
|
97
|
+
description: "Device battery level is below 20%",
|
|
98
|
+
createdBy: constants_1.Source.CLOUD_EVENT,
|
|
99
|
+
category: issue_types_1.IssuesCategory.READINESS,
|
|
100
|
+
priority: issue_types_1.IssuePriority.MEDIUM,
|
|
101
|
+
assignedTo: "maintenance-team",
|
|
102
|
+
dueDate: new Date("2024-01-12"),
|
|
103
|
+
entityType: issue_types_1.EntityType.DEVICE,
|
|
104
|
+
});
|
|
56
105
|
// Create a device issue with custom category and priority
|
|
57
|
-
const deviceIssue2 = await this.issueService.createDeviceIssue(
|
|
106
|
+
const deviceIssue2 = await this.issueService.createDeviceIssue({
|
|
107
|
+
entityId: "device789",
|
|
108
|
+
propertyId: "prop456",
|
|
109
|
+
title: "Device Firmware Update Available",
|
|
110
|
+
description: "New firmware version is available for installation",
|
|
111
|
+
createdBy: constants_1.Source.CLOUD_EVENT,
|
|
112
|
+
category: issue_types_1.IssuesCategory.READINESS,
|
|
113
|
+
priority: issue_types_1.IssuePriority.MEDIUM,
|
|
114
|
+
assignedTo: "admin",
|
|
115
|
+
dueDate: new Date("2024-01-20"),
|
|
116
|
+
entityType: issue_types_1.EntityType.DEVICE,
|
|
117
|
+
});
|
|
58
118
|
return { deviceIssue1, deviceIssue2 };
|
|
59
119
|
}
|
|
60
120
|
/**
|
|
@@ -62,11 +122,31 @@ class IssueServiceExample {
|
|
|
62
122
|
*/
|
|
63
123
|
async createHubIssues() {
|
|
64
124
|
// Create a hub issue with default settings
|
|
65
|
-
const hubIssue1 = await this.issueService.createHubIssue(
|
|
66
|
-
|
|
67
|
-
|
|
125
|
+
const hubIssue1 = await this.issueService.createHubIssue({
|
|
126
|
+
entityId: "hub123",
|
|
127
|
+
propertyId: "prop456",
|
|
128
|
+
title: "Hub Connection Lost",
|
|
129
|
+
description: "Hub has lost connection to the network",
|
|
130
|
+
createdBy: "network-monitor",
|
|
131
|
+
category: issue_types_1.IssuesCategory.READINESS,
|
|
132
|
+
priority: issue_types_1.IssuePriority.MEDIUM,
|
|
133
|
+
assignedTo: "network-admin",
|
|
134
|
+
dueDate: new Date("2024-01-05"),
|
|
135
|
+
entityType: issue_types_1.EntityType.HUB,
|
|
136
|
+
});
|
|
68
137
|
// Create a hub issue with custom settings
|
|
69
|
-
const hubIssue2 = await this.issueService.createHubIssue(
|
|
138
|
+
const hubIssue2 = await this.issueService.createHubIssue({
|
|
139
|
+
entityId: "hub789",
|
|
140
|
+
propertyId: "prop456",
|
|
141
|
+
title: "Hub Maintenance Required",
|
|
142
|
+
description: "Hub requires scheduled maintenance",
|
|
143
|
+
createdBy: "maintenance-system",
|
|
144
|
+
category: issue_types_1.IssuesCategory.READINESS,
|
|
145
|
+
priority: issue_types_1.IssuePriority.LOW,
|
|
146
|
+
assignedTo: "technician",
|
|
147
|
+
dueDate: new Date("2024-01-15"),
|
|
148
|
+
entityType: issue_types_1.EntityType.HUB,
|
|
149
|
+
});
|
|
70
150
|
return { hubIssue1, hubIssue2 };
|
|
71
151
|
}
|
|
72
152
|
/**
|
|
@@ -74,7 +154,18 @@ class IssueServiceExample {
|
|
|
74
154
|
*/
|
|
75
155
|
async createUserIssues() {
|
|
76
156
|
// Create a user issue
|
|
77
|
-
const userIssue = await this.issueService.createUserIssue(
|
|
157
|
+
const userIssue = await this.issueService.createUserIssue({
|
|
158
|
+
entityId: "user456",
|
|
159
|
+
propertyId: "prop303",
|
|
160
|
+
title: "User Access Review Required",
|
|
161
|
+
description: "User access permissions need review",
|
|
162
|
+
createdBy: "access-control",
|
|
163
|
+
category: issue_types_1.IssuesCategory.SECURITY,
|
|
164
|
+
priority: issue_types_1.IssuePriority.MEDIUM,
|
|
165
|
+
assignedTo: "hr-admin",
|
|
166
|
+
dueDate: new Date("2024-01-30"),
|
|
167
|
+
entityType: issue_types_1.EntityType.USER,
|
|
168
|
+
});
|
|
78
169
|
return { userIssue };
|
|
79
170
|
}
|
|
80
171
|
/**
|
|
@@ -82,9 +173,31 @@ class IssueServiceExample {
|
|
|
82
173
|
*/
|
|
83
174
|
async createMaintenanceAndUrgentIssues() {
|
|
84
175
|
// Create a maintenance issue
|
|
85
|
-
const maintenanceIssue = await this.issueService.createMaintenanceIssue(
|
|
176
|
+
const maintenanceIssue = await this.issueService.createMaintenanceIssue({
|
|
177
|
+
propertyId: "prop505",
|
|
178
|
+
title: "Scheduled Device Maintenance",
|
|
179
|
+
description: "Regular maintenance is scheduled for this device",
|
|
180
|
+
createdBy: "maintenance-scheduler",
|
|
181
|
+
entityId: "device789",
|
|
182
|
+
entityType: issue_types_1.EntityType.DEVICE,
|
|
183
|
+
assignedTo: "technician",
|
|
184
|
+
dueDate: new Date("2024-01-12"),
|
|
185
|
+
category: issue_types_1.IssuesCategory.READINESS,
|
|
186
|
+
priority: issue_types_1.IssuePriority.MEDIUM,
|
|
187
|
+
});
|
|
86
188
|
// Create an urgent issue
|
|
87
|
-
const urgentIssue = await this.issueService.createUrgentIssue(
|
|
189
|
+
const urgentIssue = await this.issueService.createUrgentIssue({
|
|
190
|
+
propertyId: "prop606",
|
|
191
|
+
title: "Critical Hub Failure",
|
|
192
|
+
description: "Hub is experiencing critical failures",
|
|
193
|
+
createdBy: "monitoring-system",
|
|
194
|
+
entityId: "hub123",
|
|
195
|
+
entityType: issue_types_1.EntityType.HUB,
|
|
196
|
+
assignedTo: "emergency-tech",
|
|
197
|
+
dueDate: new Date("2024-01-03"),
|
|
198
|
+
category: issue_types_1.IssuesCategory.READINESS,
|
|
199
|
+
priority: issue_types_1.IssuePriority.CRITICAL,
|
|
200
|
+
});
|
|
88
201
|
return { maintenanceIssue, urgentIssue };
|
|
89
202
|
}
|
|
90
203
|
/**
|
package/dist/issues/index.d.ts
CHANGED
package/dist/issues/index.js
CHANGED
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./Issue.service"), exports);
|
|
18
18
|
__exportStar(require("./issue.types"), exports);
|
|
19
|
+
__exportStar(require("./IssueBuilder"), exports);
|
|
@@ -63,7 +63,7 @@ export interface CreateIssueData {
|
|
|
63
63
|
propertyId: string;
|
|
64
64
|
title: string;
|
|
65
65
|
description: string;
|
|
66
|
-
entityId
|
|
66
|
+
entityId: string;
|
|
67
67
|
entityType: EntityType;
|
|
68
68
|
priority?: IssuePriority;
|
|
69
69
|
assignedTo?: string;
|
|
@@ -79,7 +79,7 @@ export interface UpdateIssueData {
|
|
|
79
79
|
status?: IssueStatus;
|
|
80
80
|
priority?: IssuePriority;
|
|
81
81
|
assignedTo?: string;
|
|
82
|
-
updatedBy
|
|
82
|
+
updatedBy?: string;
|
|
83
83
|
resolvedAt?: Date;
|
|
84
84
|
dueDate?: Date;
|
|
85
85
|
isDeleted?: boolean;
|
|
@@ -88,3 +88,18 @@ export interface AddCommentData {
|
|
|
88
88
|
userId: string;
|
|
89
89
|
content: string;
|
|
90
90
|
}
|
|
91
|
+
export interface IIssueQuery {
|
|
92
|
+
propertyId?: string;
|
|
93
|
+
assignedTo?: string;
|
|
94
|
+
status?: IssueStatus;
|
|
95
|
+
priority?: IssuePriority;
|
|
96
|
+
category?: IssuesCategory;
|
|
97
|
+
entityType?: EntityType;
|
|
98
|
+
entityId?: string;
|
|
99
|
+
includeDeleted?: boolean;
|
|
100
|
+
limit?: number;
|
|
101
|
+
skip?: number;
|
|
102
|
+
sort?: {
|
|
103
|
+
[key: string]: 1 | -1;
|
|
104
|
+
};
|
|
105
|
+
}
|