@oneuptime/common 8.0.5311 → 8.0.5326
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/Models/DatabaseModels/GlobalConfig.ts +90 -0
- package/Models/DatabaseModels/Index.ts +4 -0
- package/Models/DatabaseModels/Project.ts +27 -0
- package/Models/DatabaseModels/UserNotificationRule.ts +48 -0
- package/Models/DatabaseModels/UserNotificationSetting.ts +16 -0
- package/Models/DatabaseModels/UserOnCallLogTimeline.ts +48 -0
- package/Models/DatabaseModels/UserWhatsApp.ts +288 -0
- package/Models/DatabaseModels/WhatsAppLog.ts +884 -0
- package/Server/API/NotificationAPI.ts +4 -4
- package/Server/API/ProjectSSO.ts +41 -33
- package/Server/API/ShortLinkAPI.ts +33 -25
- package/Server/API/UserCallAPI.ts +82 -73
- package/Server/API/UserEmailAPI.ts +82 -73
- package/Server/API/UserOnCallLogTimelineAPI.ts +227 -214
- package/Server/API/UserPushAPI.ts +177 -169
- package/Server/API/UserSmsAPI.ts +82 -73
- package/Server/API/UserWhatsAppAPI.ts +136 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1759838763506-MigrationName.ts +105 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1759839342566-MigrationName.ts +71 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
- package/Server/Services/Index.ts +4 -0
- package/Server/Services/MonitorService.ts +32 -4
- package/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.ts +36 -4
- package/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.ts +34 -4
- package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +34 -4
- package/Server/Services/OnCallDutyPolicyScheduleService.ts +47 -6
- package/Server/Services/ProbeService.ts +17 -2
- package/Server/Services/UserNotificationRuleService.ts +258 -7
- package/Server/Services/UserNotificationSettingService.ts +60 -0
- package/Server/Services/UserWhatsAppService.ts +203 -0
- package/Server/Services/WhatsAppLogService.ts +15 -0
- package/Server/Services/WhatsAppService.ts +141 -0
- package/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.ts +17 -5
- package/Server/Types/Workflow/Components/Webhook.ts +2 -2
- package/Server/Utils/StartServer.ts +57 -31
- package/Server/Utils/WhatsAppTemplateUtil.ts +247 -0
- package/Types/Icon/IconProp.ts +1 -0
- package/Types/WhatsApp/WhatsAppMessage.ts +12 -0
- package/Types/WhatsApp/WhatsAppTemplates.ts +197 -0
- package/Types/WhatsAppStatus.ts +8 -0
- package/UI/Components/Icon/Icon.tsx +12 -0
- package/build/dist/Models/DatabaseModels/GlobalConfig.js +98 -0
- package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +4 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +29 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserNotificationRule.js +48 -0
- package/build/dist/Models/DatabaseModels/UserNotificationRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserNotificationSetting.js +18 -0
- package/build/dist/Models/DatabaseModels/UserNotificationSetting.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js +48 -0
- package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserWhatsApp.js +308 -0
- package/build/dist/Models/DatabaseModels/UserWhatsApp.js.map +1 -0
- package/build/dist/Models/DatabaseModels/WhatsAppLog.js +911 -0
- package/build/dist/Models/DatabaseModels/WhatsAppLog.js.map +1 -0
- package/build/dist/Server/API/NotificationAPI.js +2 -2
- package/build/dist/Server/API/NotificationAPI.js.map +1 -1
- package/build/dist/Server/API/ProjectSSO.js +26 -21
- package/build/dist/Server/API/ProjectSSO.js.map +1 -1
- package/build/dist/Server/API/ShortLinkAPI.js +17 -12
- package/build/dist/Server/API/ShortLinkAPI.js.map +1 -1
- package/build/dist/Server/API/UserCallAPI.js +54 -44
- package/build/dist/Server/API/UserCallAPI.js.map +1 -1
- package/build/dist/Server/API/UserEmailAPI.js +54 -44
- package/build/dist/Server/API/UserEmailAPI.js.map +1 -1
- package/build/dist/Server/API/UserOnCallLogTimelineAPI.js +142 -127
- package/build/dist/Server/API/UserOnCallLogTimelineAPI.js.map +1 -1
- package/build/dist/Server/API/UserPushAPI.js +111 -96
- package/build/dist/Server/API/UserPushAPI.js.map +1 -1
- package/build/dist/Server/API/UserSmsAPI.js +54 -44
- package/build/dist/Server/API/UserSmsAPI.js.map +1 -1
- package/build/dist/Server/API/UserWhatsAppAPI.js +76 -0
- package/build/dist/Server/API/UserWhatsAppAPI.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1759838763506-MigrationName.js +42 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1759838763506-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1759839342566-MigrationName.js +30 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1759839342566-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/Index.js +4 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +23 -2
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js +29 -6
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js +27 -6
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +26 -5
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +34 -3
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
- package/build/dist/Server/Services/ProbeService.js +12 -1
- package/build/dist/Server/Services/ProbeService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationRuleService.js +196 -19
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationSettingService.js +45 -0
- package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
- package/build/dist/Server/Services/UserWhatsAppService.js +179 -0
- package/build/dist/Server/Services/UserWhatsAppService.js.map +1 -0
- package/build/dist/Server/Services/WhatsAppLogService.js +13 -0
- package/build/dist/Server/Services/WhatsAppLogService.js.map +1 -0
- package/build/dist/Server/Services/WhatsAppService.js +103 -0
- package/build/dist/Server/Services/WhatsAppService.js.map +1 -0
- package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js +14 -4
- package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/Webhook.js +2 -2
- package/build/dist/Server/Types/Workflow/Components/Webhook.js.map +1 -1
- package/build/dist/Server/Utils/StartServer.js +41 -19
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js +124 -0
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js.map +1 -0
- package/build/dist/Types/Icon/IconProp.js +1 -0
- package/build/dist/Types/Icon/IconProp.js.map +1 -1
- package/build/dist/Types/WhatsApp/WhatsAppMessage.js +2 -0
- package/build/dist/Types/WhatsApp/WhatsAppMessage.js.map +1 -0
- package/build/dist/Types/WhatsApp/WhatsAppTemplates.js +118 -0
- package/build/dist/Types/WhatsApp/WhatsAppTemplates.js.map +1 -0
- package/build/dist/Types/WhatsAppStatus.js +9 -0
- package/build/dist/Types/WhatsAppStatus.js.map +1 -0
- package/build/dist/UI/Components/Icon/Icon.js +6 -0
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,45 +16,50 @@ export default class UserNotificationLogTimelineAPI extends BaseAPI {
|
|
|
16
16
|
var _a, _b, _c;
|
|
17
17
|
super(UserOnCallLogTimeline, UserOnCallLogTimelineService);
|
|
18
18
|
this.router.post(`${(_a = new this.entityType()
|
|
19
|
-
.getCrudApiPath()) === null || _a === void 0 ? void 0 : _a.toString()}/call/gather-input/:itemId`, NotificationMiddleware.isValidCallNotificationRequest, async (req, res) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
select: {
|
|
29
|
-
_id: true,
|
|
30
|
-
projectId: true,
|
|
31
|
-
triggeredByIncidentId: true,
|
|
32
|
-
triggeredByAlertId: true,
|
|
33
|
-
},
|
|
34
|
-
props: {
|
|
35
|
-
isRoot: true,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
if (!timelineItem) {
|
|
39
|
-
return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
|
|
40
|
-
}
|
|
41
|
-
// check digits.
|
|
42
|
-
if (req.body["Digits"] === "1") {
|
|
43
|
-
// then ack incident
|
|
44
|
-
await this.service.updateOneById({
|
|
19
|
+
.getCrudApiPath()) === null || _a === void 0 ? void 0 : _a.toString()}/call/gather-input/:itemId`, NotificationMiddleware.isValidCallNotificationRequest, async (req, res, next) => {
|
|
20
|
+
try {
|
|
21
|
+
req = req;
|
|
22
|
+
if (!req.params["itemId"]) {
|
|
23
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Invalid item ID"));
|
|
24
|
+
}
|
|
25
|
+
const token = req.callTokenData;
|
|
26
|
+
const itemId = new ObjectID(req.params["itemId"]);
|
|
27
|
+
const timelineItem = await this.service.findOneById({
|
|
45
28
|
id: itemId,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
29
|
+
select: {
|
|
30
|
+
_id: true,
|
|
31
|
+
projectId: true,
|
|
32
|
+
triggeredByIncidentId: true,
|
|
33
|
+
triggeredByAlertId: true,
|
|
51
34
|
},
|
|
52
35
|
props: {
|
|
53
36
|
isRoot: true,
|
|
54
37
|
},
|
|
55
38
|
});
|
|
39
|
+
if (!timelineItem) {
|
|
40
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
|
|
41
|
+
}
|
|
42
|
+
// check digits.
|
|
43
|
+
if (req.body["Digits"] === "1") {
|
|
44
|
+
// then ack incident
|
|
45
|
+
await this.service.updateOneById({
|
|
46
|
+
id: itemId,
|
|
47
|
+
data: {
|
|
48
|
+
acknowledgedAt: OneUptimeDate.getCurrentDate(),
|
|
49
|
+
isAcknowledged: true,
|
|
50
|
+
status: UserNotificationStatus.Acknowledged,
|
|
51
|
+
statusMessage: "Notification Acknowledged",
|
|
52
|
+
},
|
|
53
|
+
props: {
|
|
54
|
+
isRoot: true,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return NotificationMiddleware.sendResponse(req, res, token);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
return next(error);
|
|
56
62
|
}
|
|
57
|
-
return NotificationMiddleware.sendResponse(req, res, token);
|
|
58
63
|
});
|
|
59
64
|
/*
|
|
60
65
|
* We have this ack page to show the user a confirmation page before acknowledging the notification.
|
|
@@ -62,114 +67,124 @@ export default class UserNotificationLogTimelineAPI extends BaseAPI {
|
|
|
62
67
|
* so we need to create this page for the user to confirm that they want to acknowledge the notification.
|
|
63
68
|
*/
|
|
64
69
|
this.router.get(`${(_b = new this.entityType()
|
|
65
|
-
.getCrudApiPath()) === null || _b === void 0 ? void 0 : _b.toString()}/acknowledge-page/:itemId`, async (req, res) => {
|
|
70
|
+
.getCrudApiPath()) === null || _b === void 0 ? void 0 : _b.toString()}/acknowledge-page/:itemId`, async (req, res, next) => {
|
|
66
71
|
var _a, _b;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
try {
|
|
73
|
+
req = req;
|
|
74
|
+
if (!req.params["itemId"]) {
|
|
75
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Item ID is required"));
|
|
76
|
+
}
|
|
77
|
+
const itemId = new ObjectID(req.params["itemId"]);
|
|
78
|
+
const timelineItem = await this.service.findOneById({
|
|
79
|
+
id: itemId,
|
|
80
|
+
select: {
|
|
81
|
+
_id: true,
|
|
82
|
+
projectId: true,
|
|
83
|
+
triggeredByIncidentId: true,
|
|
84
|
+
triggeredByIncident: {
|
|
85
|
+
title: true,
|
|
86
|
+
description: true,
|
|
87
|
+
},
|
|
88
|
+
triggeredByAlertId: true,
|
|
89
|
+
triggeredByAlert: {
|
|
90
|
+
title: true,
|
|
91
|
+
description: true,
|
|
92
|
+
},
|
|
81
93
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
title: true,
|
|
85
|
-
description: true,
|
|
94
|
+
props: {
|
|
95
|
+
isRoot: true,
|
|
86
96
|
},
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
});
|
|
98
|
+
if (!timelineItem) {
|
|
99
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
|
|
100
|
+
}
|
|
101
|
+
const notificationType = timelineItem.triggeredByIncidentId
|
|
102
|
+
? "Incident"
|
|
103
|
+
: "Alert";
|
|
104
|
+
const host = await DatabaseConfig.getHost();
|
|
105
|
+
const httpProtocol = await DatabaseConfig.getHttpProtocol();
|
|
106
|
+
return Response.render(req, res, "/usr/src/Common/Server/Views/AcknowledgeUserOnCallNotification.ejs", {
|
|
107
|
+
title: `Acknowledge ${notificationType} - ${((_a = timelineItem.triggeredByIncident) === null || _a === void 0 ? void 0 : _a.title) || ((_b = timelineItem.triggeredByAlert) === null || _b === void 0 ? void 0 : _b.title)}`,
|
|
108
|
+
message: `Do you want to acknowledge this ${notificationType}?`,
|
|
109
|
+
acknowledgeText: `Acknowledge ${notificationType}`,
|
|
110
|
+
acknowledgeUrl: new URL(httpProtocol, host, new Route(AppApiRoute.toString())
|
|
111
|
+
.addRoute(new UserOnCallLogTimeline().crudApiPath)
|
|
112
|
+
.addRoute("/acknowledge/" + itemId.toString())).toString(),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
return next(error);
|
|
94
117
|
}
|
|
95
|
-
const notificationType = timelineItem.triggeredByIncidentId
|
|
96
|
-
? "Incident"
|
|
97
|
-
: "Alert";
|
|
98
|
-
const host = await DatabaseConfig.getHost();
|
|
99
|
-
const httpProtocol = await DatabaseConfig.getHttpProtocol();
|
|
100
|
-
return Response.render(req, res, "/usr/src/Common/Server/Views/AcknowledgeUserOnCallNotification.ejs", {
|
|
101
|
-
title: `Acknowledge ${notificationType} - ${((_a = timelineItem.triggeredByIncident) === null || _a === void 0 ? void 0 : _a.title) || ((_b = timelineItem.triggeredByAlert) === null || _b === void 0 ? void 0 : _b.title)}`,
|
|
102
|
-
message: `Do you want to acknowledge this ${notificationType}?`,
|
|
103
|
-
acknowledgeText: `Acknowledge ${notificationType}`,
|
|
104
|
-
acknowledgeUrl: new URL(httpProtocol, host, new Route(AppApiRoute.toString())
|
|
105
|
-
.addRoute(new UserOnCallLogTimeline().crudApiPath)
|
|
106
|
-
.addRoute("/acknowledge/" + itemId.toString())).toString(),
|
|
107
|
-
});
|
|
108
118
|
});
|
|
109
119
|
// This is the link that actually acknowledges the notification.
|
|
110
120
|
this.router.get(`${(_c = new this.entityType()
|
|
111
|
-
.getCrudApiPath()) === null || _c === void 0 ? void 0 : _c.toString()}/acknowledge/:itemId`, async (req, res) => {
|
|
121
|
+
.getCrudApiPath()) === null || _c === void 0 ? void 0 : _c.toString()}/acknowledge/:itemId`, async (req, res, next) => {
|
|
112
122
|
var _a, _b, _c, _d, _e;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
try {
|
|
124
|
+
req = req;
|
|
125
|
+
if (!req.params["itemId"]) {
|
|
126
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Item ID is required"));
|
|
127
|
+
}
|
|
128
|
+
const itemId = new ObjectID(req.params["itemId"]);
|
|
129
|
+
const timelineItem = await this.service.findOneById({
|
|
130
|
+
id: itemId,
|
|
131
|
+
select: {
|
|
132
|
+
_id: true,
|
|
133
|
+
projectId: true,
|
|
134
|
+
triggeredByIncidentId: true,
|
|
135
|
+
triggeredByAlertId: true,
|
|
136
|
+
triggeredByAlert: {
|
|
137
|
+
title: true,
|
|
138
|
+
},
|
|
139
|
+
triggeredByIncident: {
|
|
140
|
+
title: true,
|
|
141
|
+
},
|
|
142
|
+
acknowledgedAt: true,
|
|
143
|
+
isAcknowledged: true,
|
|
127
144
|
},
|
|
128
|
-
|
|
129
|
-
|
|
145
|
+
props: {
|
|
146
|
+
isRoot: true,
|
|
130
147
|
},
|
|
131
|
-
acknowledgedAt: true,
|
|
132
|
-
isAcknowledged: true,
|
|
133
|
-
},
|
|
134
|
-
props: {
|
|
135
|
-
isRoot: true,
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
if (!timelineItem) {
|
|
139
|
-
return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
|
|
140
|
-
}
|
|
141
|
-
const host = await DatabaseConfig.getHost();
|
|
142
|
-
const httpProtocol = await DatabaseConfig.getHttpProtocol();
|
|
143
|
-
if (timelineItem.isAcknowledged) {
|
|
144
|
-
// already acknowledged. Then show already acknowledged page with view details button.
|
|
145
|
-
const viewDetailsUrl = new URL(httpProtocol, host, DashboardRoute.addRoute(`/${(_a = timelineItem.projectId) === null || _a === void 0 ? void 0 : _a.toString()}/${timelineItem.triggeredByIncidentId ? "incidents" : "alerts"}/${timelineItem.triggeredByIncidentId ? timelineItem.triggeredByIncidentId.toString() : timelineItem.triggeredByAlertId.toString()}`));
|
|
146
|
-
return Response.render(req, res, "/usr/src/Common/Server/Views/ViewMessage.ejs", {
|
|
147
|
-
title: `Notification Already Acknowledged - ${((_b = timelineItem.triggeredByIncident) === null || _b === void 0 ? void 0 : _b.title) || ((_c = timelineItem.triggeredByAlert) === null || _c === void 0 ? void 0 : _c.title)}`,
|
|
148
|
-
message: `This notification has already been acknowledged.`,
|
|
149
|
-
viewDetailsText: `View ${timelineItem.triggeredByIncidentId ? "Incident" : "Alert"}`,
|
|
150
|
-
viewDetailsUrl: viewDetailsUrl.toString(),
|
|
151
148
|
});
|
|
149
|
+
if (!timelineItem) {
|
|
150
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
|
|
151
|
+
}
|
|
152
|
+
const host = await DatabaseConfig.getHost();
|
|
153
|
+
const httpProtocol = await DatabaseConfig.getHttpProtocol();
|
|
154
|
+
if (timelineItem.isAcknowledged) {
|
|
155
|
+
// already acknowledged. Then show already acknowledged page with view details button.
|
|
156
|
+
const viewDetailsUrl = new URL(httpProtocol, host, DashboardRoute.addRoute(`/${(_a = timelineItem.projectId) === null || _a === void 0 ? void 0 : _a.toString()}/${timelineItem.triggeredByIncidentId ? "incidents" : "alerts"}/${timelineItem.triggeredByIncidentId ? timelineItem.triggeredByIncidentId.toString() : timelineItem.triggeredByAlertId.toString()}`));
|
|
157
|
+
return Response.render(req, res, "/usr/src/Common/Server/Views/ViewMessage.ejs", {
|
|
158
|
+
title: `Notification Already Acknowledged - ${((_b = timelineItem.triggeredByIncident) === null || _b === void 0 ? void 0 : _b.title) || ((_c = timelineItem.triggeredByAlert) === null || _c === void 0 ? void 0 : _c.title)}`,
|
|
159
|
+
message: `This notification has already been acknowledged.`,
|
|
160
|
+
viewDetailsText: `View ${timelineItem.triggeredByIncidentId ? "Incident" : "Alert"}`,
|
|
161
|
+
viewDetailsUrl: viewDetailsUrl.toString(),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
await this.service.updateOneById({
|
|
165
|
+
id: itemId,
|
|
166
|
+
data: {
|
|
167
|
+
acknowledgedAt: OneUptimeDate.getCurrentDate(),
|
|
168
|
+
isAcknowledged: true,
|
|
169
|
+
status: UserNotificationStatus.Acknowledged,
|
|
170
|
+
statusMessage: "Notification Acknowledged",
|
|
171
|
+
},
|
|
172
|
+
props: {
|
|
173
|
+
isRoot: true,
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
// redirect to dashboard to incidents page.
|
|
177
|
+
if (timelineItem.triggeredByIncidentId) {
|
|
178
|
+
return Response.redirect(req, res, new URL(httpProtocol, host, DashboardRoute.addRoute(`/${(_d = timelineItem.projectId) === null || _d === void 0 ? void 0 : _d.toString()}/incidents/${timelineItem.triggeredByIncidentId.toString()}`)));
|
|
179
|
+
}
|
|
180
|
+
if (timelineItem.triggeredByAlertId) {
|
|
181
|
+
return Response.redirect(req, res, new URL(httpProtocol, host, DashboardRoute.addRoute(`/${(_e = timelineItem.projectId) === null || _e === void 0 ? void 0 : _e.toString()}/alerts/${timelineItem.triggeredByAlertId.toString()}`)));
|
|
182
|
+
}
|
|
183
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
|
|
152
184
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
data: {
|
|
156
|
-
acknowledgedAt: OneUptimeDate.getCurrentDate(),
|
|
157
|
-
isAcknowledged: true,
|
|
158
|
-
status: UserNotificationStatus.Acknowledged,
|
|
159
|
-
statusMessage: "Notification Acknowledged",
|
|
160
|
-
},
|
|
161
|
-
props: {
|
|
162
|
-
isRoot: true,
|
|
163
|
-
},
|
|
164
|
-
});
|
|
165
|
-
// redirect to dashboard to incidents page.
|
|
166
|
-
if (timelineItem.triggeredByIncidentId) {
|
|
167
|
-
return Response.redirect(req, res, new URL(httpProtocol, host, DashboardRoute.addRoute(`/${(_d = timelineItem.projectId) === null || _d === void 0 ? void 0 : _d.toString()}/incidents/${timelineItem.triggeredByIncidentId.toString()}`)));
|
|
168
|
-
}
|
|
169
|
-
if (timelineItem.triggeredByAlertId) {
|
|
170
|
-
return Response.redirect(req, res, new URL(httpProtocol, host, DashboardRoute.addRoute(`/${(_e = timelineItem.projectId) === null || _e === void 0 ? void 0 : _e.toString()}/alerts/${timelineItem.triggeredByAlertId.toString()}`)));
|
|
185
|
+
catch (error) {
|
|
186
|
+
return next(error);
|
|
171
187
|
}
|
|
172
|
-
return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
|
|
173
188
|
});
|
|
174
189
|
}
|
|
175
190
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserOnCallLogTimelineAPI.js","sourceRoot":"","sources":["../../../../Server/API/UserOnCallLogTimelineAPI.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,sBAAsB,MAAM,sCAAsC,CAAC;AAC1E,OAAO,4BAEN,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"UserOnCallLogTimelineAPI.js","sourceRoot":"","sources":["../../../../Server/API/UserOnCallLogTimelineAPI.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,sBAAsB,MAAM,sCAAsC,CAAC;AAC1E,OAAO,4BAEN,MAAM,0CAA0C,CAAC;AAOlD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,o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AE,CAAC;gBACf,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -63,120 +63,135 @@ export default class UserPushAPI extends BaseAPI {
|
|
|
63
63
|
next(error);
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
-
this.router.post(`/user-push/:deviceId/test-notification`, UserMiddleware.getUserMiddleware, async (req, res) => {
|
|
66
|
+
this.router.post(`/user-push/:deviceId/test-notification`, UserMiddleware.getUserMiddleware, async (req, res, next) => {
|
|
67
67
|
var _a;
|
|
68
|
-
req = req;
|
|
69
|
-
if (!req.params["deviceId"]) {
|
|
70
|
-
return Response.sendErrorResponse(req, res, new BadDataException("Device ID is required"));
|
|
71
|
-
}
|
|
72
|
-
// Get the device
|
|
73
|
-
const device = await this.service.findOneById({
|
|
74
|
-
id: new ObjectID(req.params["deviceId"]),
|
|
75
|
-
props: {
|
|
76
|
-
isRoot: true,
|
|
77
|
-
},
|
|
78
|
-
select: {
|
|
79
|
-
userId: true,
|
|
80
|
-
deviceName: true,
|
|
81
|
-
deviceToken: true,
|
|
82
|
-
deviceType: true,
|
|
83
|
-
isVerified: true,
|
|
84
|
-
projectId: true,
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
if (!device) {
|
|
88
|
-
return Response.sendErrorResponse(req, res, new BadDataException("Device not found"));
|
|
89
|
-
}
|
|
90
|
-
// Check if the device belongs to the current user
|
|
91
|
-
if (((_a = device.userId) === null || _a === void 0 ? void 0 : _a.toString()) !==
|
|
92
|
-
req.userAuthorization.userId.toString()) {
|
|
93
|
-
return Response.sendErrorResponse(req, res, new BadDataException("Unauthorized access to device"));
|
|
94
|
-
}
|
|
95
|
-
if (!device.isVerified) {
|
|
96
|
-
return Response.sendErrorResponse(req, res, new BadDataException("Device is not verified"));
|
|
97
|
-
}
|
|
98
68
|
try {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
projectId: device.projectId,
|
|
118
|
-
userId: device.userId,
|
|
69
|
+
req = req;
|
|
70
|
+
if (!req.params["deviceId"]) {
|
|
71
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Device ID is required"));
|
|
72
|
+
}
|
|
73
|
+
// Get the device
|
|
74
|
+
const device = await this.service.findOneById({
|
|
75
|
+
id: new ObjectID(req.params["deviceId"]),
|
|
76
|
+
props: {
|
|
77
|
+
isRoot: true,
|
|
78
|
+
},
|
|
79
|
+
select: {
|
|
80
|
+
userId: true,
|
|
81
|
+
deviceName: true,
|
|
82
|
+
deviceToken: true,
|
|
83
|
+
deviceType: true,
|
|
84
|
+
isVerified: true,
|
|
85
|
+
projectId: true,
|
|
86
|
+
},
|
|
119
87
|
});
|
|
88
|
+
if (!device) {
|
|
89
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Device not found"));
|
|
90
|
+
}
|
|
91
|
+
// Check if the device belongs to the current user
|
|
92
|
+
if (((_a = device.userId) === null || _a === void 0 ? void 0 : _a.toString()) !==
|
|
93
|
+
req.userAuthorization.userId.toString()) {
|
|
94
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Unauthorized access to device"));
|
|
95
|
+
}
|
|
96
|
+
if (!device.isVerified) {
|
|
97
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Device is not verified"));
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
// Send test notification
|
|
101
|
+
const testMessage = PushNotificationUtil.createGenericNotification({
|
|
102
|
+
title: "Test Notification from OneUptime",
|
|
103
|
+
body: "This is a test notification to verify your device is working correctly.",
|
|
104
|
+
clickAction: "/dashboard",
|
|
105
|
+
tag: "test-notification",
|
|
106
|
+
requireInteraction: false,
|
|
107
|
+
});
|
|
108
|
+
await PushNotificationService.sendPushNotification({
|
|
109
|
+
devices: [
|
|
110
|
+
Object.assign({ token: device.deviceToken }, (device.deviceName && {
|
|
111
|
+
name: device.deviceName,
|
|
112
|
+
})),
|
|
113
|
+
],
|
|
114
|
+
message: testMessage,
|
|
115
|
+
deviceType: device.deviceType,
|
|
116
|
+
}, {
|
|
117
|
+
isSensitive: false,
|
|
118
|
+
projectId: device.projectId,
|
|
119
|
+
userId: device.userId,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
throw new BadDataException(`Failed to send test notification: ${error.message}`);
|
|
124
|
+
}
|
|
120
125
|
return Response.sendJsonObjectResponse(req, res, {
|
|
121
126
|
success: true,
|
|
122
127
|
message: "Test notification sent successfully",
|
|
123
128
|
});
|
|
124
129
|
}
|
|
125
130
|
catch (error) {
|
|
126
|
-
return
|
|
131
|
+
return next(error);
|
|
127
132
|
}
|
|
128
133
|
});
|
|
129
|
-
this.router.post(`/user-push/:deviceId/verify`, UserMiddleware.getUserMiddleware, async (req, res) => {
|
|
134
|
+
this.router.post(`/user-push/:deviceId/verify`, UserMiddleware.getUserMiddleware, async (req, res, next) => {
|
|
130
135
|
var _a;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
136
|
+
try {
|
|
137
|
+
req = req;
|
|
138
|
+
if (!req.params["deviceId"]) {
|
|
139
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Device ID is required"));
|
|
140
|
+
}
|
|
141
|
+
const device = await this.service.findOneById({
|
|
142
|
+
id: new ObjectID(req.params["deviceId"]),
|
|
143
|
+
props: {
|
|
144
|
+
isRoot: true,
|
|
145
|
+
},
|
|
146
|
+
select: {
|
|
147
|
+
userId: true,
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
if (!device) {
|
|
151
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Device not found"));
|
|
152
|
+
}
|
|
153
|
+
// Check if the device belongs to the current user
|
|
154
|
+
if (((_a = device.userId) === null || _a === void 0 ? void 0 : _a.toString()) !==
|
|
155
|
+
req.userAuthorization.userId.toString()) {
|
|
156
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Unauthorized access to device"));
|
|
157
|
+
}
|
|
158
|
+
await this.service.verifyDevice(device._id.toString());
|
|
159
|
+
return Response.sendEmptySuccessResponse(req, res);
|
|
146
160
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
req.userAuthorization.userId.toString()) {
|
|
150
|
-
return Response.sendErrorResponse(req, res, new BadDataException("Unauthorized access to device"));
|
|
161
|
+
catch (error) {
|
|
162
|
+
return next(error);
|
|
151
163
|
}
|
|
152
|
-
await this.service.verifyDevice(device._id.toString());
|
|
153
|
-
return Response.sendEmptySuccessResponse(req, res);
|
|
154
164
|
});
|
|
155
|
-
this.router.post(`/user-push/:deviceId/unverify`, UserMiddleware.getUserMiddleware, async (req, res) => {
|
|
165
|
+
this.router.post(`/user-push/:deviceId/unverify`, UserMiddleware.getUserMiddleware, async (req, res, next) => {
|
|
156
166
|
var _a;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
try {
|
|
168
|
+
req = req;
|
|
169
|
+
if (!req.params["deviceId"]) {
|
|
170
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Device ID is required"));
|
|
171
|
+
}
|
|
172
|
+
const device = await this.service.findOneById({
|
|
173
|
+
id: new ObjectID(req.params["deviceId"]),
|
|
174
|
+
props: {
|
|
175
|
+
isRoot: true,
|
|
176
|
+
},
|
|
177
|
+
select: {
|
|
178
|
+
userId: true,
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
if (!device) {
|
|
182
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Device not found"));
|
|
183
|
+
}
|
|
184
|
+
// Check if the device belongs to the current user
|
|
185
|
+
if (((_a = device.userId) === null || _a === void 0 ? void 0 : _a.toString()) !==
|
|
186
|
+
req.userAuthorization.userId.toString()) {
|
|
187
|
+
return Response.sendErrorResponse(req, res, new BadDataException("Unauthorized access to device"));
|
|
188
|
+
}
|
|
189
|
+
await this.service.unverifyDevice(device._id.toString());
|
|
190
|
+
return Response.sendEmptySuccessResponse(req, res);
|
|
172
191
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
req.userAuthorization.userId.toString()) {
|
|
176
|
-
return Response.sendErrorResponse(req, res, new BadDataException("Unauthorized access to device"));
|
|
192
|
+
catch (error) {
|
|
193
|
+
return next(error);
|
|
177
194
|
}
|
|
178
|
-
await this.service.unverifyDevice(device._id.toString());
|
|
179
|
-
return Response.sendEmptySuccessResponse(req, res);
|
|
180
195
|
});
|
|
181
196
|
}
|
|
182
197
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserPushAPI.js","sourceRoot":"","sources":["../../../../Server/API/UserPushAPI.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,iCAAiC,CAAC;AAC7D,OAAO,eAEN,MAAM,6BAA6B,CAAC;AACrC,OAAO,uBAAuB,MAAM,qCAAqC,CAAC;AAC1E,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AAOjE,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,gBAAgB,MAAM,wCAAwC,CAAC;AACtE,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,QAAQ,MAAM,sCAAsC,CAAC;AAG5D,MAAM,CAAC,OAAO,OAAO,WAA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