@oneuptime/common 7.0.4917 → 7.0.4972
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/CallLog.ts +578 -0
- package/Models/DatabaseModels/EmailLog.ts +579 -0
- package/Models/DatabaseModels/IncidentStateTimeline.ts +1 -1
- package/Models/DatabaseModels/Index.ts +4 -0
- package/Models/DatabaseModels/PushNotificationLog.ts +877 -0
- package/Models/DatabaseModels/SmsLog.ts +578 -0
- package/Models/DatabaseModels/WorkspaceNotificationLog.ts +931 -0
- package/Server/API/StatusPageAPI.ts +2 -0
- package/Server/API/UserPushAPI.ts +12 -1
- package/Server/Infrastructure/Postgres/SchemaMigrations/1754776130988-MigrationName.ts +259 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1754828812691-MigrationName.ts +105 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1754910440587-MigrationName.ts +105 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1755030730926-MigrationName.ts +101 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1755088852971-MigrationName.ts +371 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1755093133870-MigrationName.ts +29 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1755109893911-MigrationName.ts +23 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1755110936888-MigrationName.ts +41 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +16 -0
- package/Server/Infrastructure/Queue.ts +28 -0
- package/Server/Services/CallService.ts +26 -1
- package/Server/Services/Index.ts +2 -0
- package/Server/Services/MailService.ts +60 -0
- package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +6 -0
- package/Server/Services/OnCallDutyPolicyScheduleService.ts +12 -0
- package/Server/Services/ProjectService.ts +3 -7
- package/Server/Services/PushNotificationLogService.ts +14 -0
- package/Server/Services/PushNotificationService.ts +129 -13
- package/Server/Services/ScheduledMaintenanceService.ts +4 -0
- package/Server/Services/SmsService.ts +25 -0
- package/Server/Services/StatusPagePrivateUserService.ts +1 -0
- package/Server/Services/StatusPageService.ts +1 -0
- package/Server/Services/StatusPageSubscriberService.ts +3 -0
- package/Server/Services/TeamMemberService.ts +1 -0
- package/Server/Services/UserCallService.ts +1 -0
- package/Server/Services/UserEmailService.ts +1 -0
- package/Server/Services/UserNotificationRuleService.ts +85 -6
- package/Server/Services/UserNotificationSettingService.ts +58 -0
- package/Server/Services/UserOnCallLogService.ts +1 -0
- package/Server/Services/UserSmsService.ts +1 -0
- package/Server/Services/WorkspaceNotificationLogService.ts +276 -0
- package/Server/Services/WorkspaceNotificationRuleService.ts +290 -33
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +21 -6
- package/Server/Utils/Workspace/Slack/Actions/Alert.ts +66 -0
- package/Server/Utils/Workspace/Slack/Actions/Incident.ts +66 -1
- package/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.ts +65 -0
- package/Server/Utils/Workspace/Slack/Slack.ts +21 -6
- package/Types/Permission.ts +20 -0
- package/Types/PushNotification/PushNotificationRequest.ts +4 -1
- package/Types/PushNotification/PushStatus.ts +6 -0
- package/Types/Workspace/WorkspaceNotificationActionType.ts +8 -0
- package/Types/Workspace/WorkspaceNotificationStatus.ts +6 -0
- package/Typings/elkjs.d.ts +30 -0
- package/UI/Components/Detail/Detail.tsx +1 -1
- package/UI/Components/Graphs/ServiceDependencyGraph.tsx +281 -0
- package/UI/Components/Tabs/Tab.tsx +8 -9
- package/UI/Components/Tabs/Tabs.tsx +17 -16
- package/Utils/Uptime/UptimeUtil.ts +20 -1
- package/build/dist/Models/DatabaseModels/CallLog.js +580 -0
- package/build/dist/Models/DatabaseModels/CallLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/EmailLog.js +580 -0
- package/build/dist/Models/DatabaseModels/EmailLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentStateTimeline.js +1 -1
- package/build/dist/Models/DatabaseModels/IncidentStateTimeline.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/PushNotificationLog.js +904 -0
- package/build/dist/Models/DatabaseModels/PushNotificationLog.js.map +1 -0
- package/build/dist/Models/DatabaseModels/SmsLog.js +580 -0
- package/build/dist/Models/DatabaseModels/SmsLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationLog.js +961 -0
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationLog.js.map +1 -0
- package/build/dist/Server/API/StatusPageAPI.js +2 -0
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/API/UserPushAPI.js +9 -1
- package/build/dist/Server/API/UserPushAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754776130988-MigrationName.js +104 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754776130988-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754828812691-MigrationName.js +42 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754828812691-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754910440587-MigrationName.js +42 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754910440587-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755030730926-MigrationName.js +44 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755030730926-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755088852971-MigrationName.js +134 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755088852971-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755093133870-MigrationName.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755093133870-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755109893911-MigrationName.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755109893911-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755110936888-MigrationName.js +20 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755110936888-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/Queue.js +28 -0
- package/build/dist/Server/Infrastructure/Queue.js.map +1 -1
- package/build/dist/Server/Services/CallService.js +12 -1
- package/build/dist/Server/Services/CallService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +2 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/MailService.js +37 -0
- package/build/dist/Server/Services/MailService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +4 -0
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +9 -0
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +3 -5
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/PushNotificationLogService.js +13 -0
- package/build/dist/Server/Services/PushNotificationLogService.js.map +1 -0
- package/build/dist/Server/Services/PushNotificationService.js +98 -13
- package/build/dist/Server/Services/PushNotificationService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceService.js +4 -0
- package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
- package/build/dist/Server/Services/SmsService.js +12 -1
- package/build/dist/Server/Services/SmsService.js.map +1 -1
- package/build/dist/Server/Services/StatusPagePrivateUserService.js +1 -0
- package/build/dist/Server/Services/StatusPagePrivateUserService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +1 -0
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageSubscriberService.js +3 -0
- package/build/dist/Server/Services/StatusPageSubscriberService.js.map +1 -1
- package/build/dist/Server/Services/TeamMemberService.js +1 -0
- package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
- package/build/dist/Server/Services/UserCallService.js +1 -0
- package/build/dist/Server/Services/UserCallService.js.map +1 -1
- package/build/dist/Server/Services/UserEmailService.js +1 -0
- package/build/dist/Server/Services/UserEmailService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationRuleService.js +70 -6
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationSettingService.js +43 -0
- package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
- package/build/dist/Server/Services/UserOnCallLogService.js +1 -0
- package/build/dist/Server/Services/UserOnCallLogService.js.map +1 -1
- package/build/dist/Server/Services/UserSmsService.js +1 -0
- package/build/dist/Server/Services/UserSmsService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceNotificationLogService.js +181 -0
- package/build/dist/Server/Services/WorkspaceNotificationLogService.js.map +1 -0
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +193 -3
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +19 -6
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js +48 -0
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js +48 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js +47 -0
- package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js +19 -6
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
- package/build/dist/Types/Permission.js +16 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/PushNotification/PushStatus.js +7 -0
- package/build/dist/Types/PushNotification/PushStatus.js.map +1 -0
- package/build/dist/Types/Workspace/WorkspaceNotificationActionType.js +9 -0
- package/build/dist/Types/Workspace/WorkspaceNotificationActionType.js.map +1 -0
- package/build/dist/Types/Workspace/WorkspaceNotificationStatus.js +7 -0
- package/build/dist/Types/Workspace/WorkspaceNotificationStatus.js.map +1 -0
- package/build/dist/UI/Components/Detail/Detail.js +1 -1
- package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
- package/build/dist/UI/Components/Graphs/ServiceDependencyGraph.js +206 -0
- package/build/dist/UI/Components/Graphs/ServiceDependencyGraph.js.map +1 -0
- package/build/dist/UI/Components/Tabs/Tab.js +6 -5
- package/build/dist/UI/Components/Tabs/Tab.js.map +1 -1
- package/build/dist/UI/Components/Tabs/Tabs.js +5 -6
- package/build/dist/UI/Components/Tabs/Tabs.js.map +1 -1
- package/build/dist/Utils/Uptime/UptimeUtil.js +10 -1
- package/build/dist/Utils/Uptime/UptimeUtil.js.map +1 -1
- package/package.json +2 -1
|
@@ -72,6 +72,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
72
72
|
userNotificationLogId: ObjectID;
|
|
73
73
|
userBelongsToTeamId?: ObjectID | undefined;
|
|
74
74
|
onCallDutyPolicyExecutionLogTimelineId?: ObjectID | undefined;
|
|
75
|
+
onCallScheduleId?: ObjectID | undefined;
|
|
75
76
|
},
|
|
76
77
|
): Promise<void> {
|
|
77
78
|
// get user notification log and see if this rule has already been executed. If so then skip.
|
|
@@ -295,6 +296,14 @@ export class Service extends DatabaseService<Model> {
|
|
|
295
296
|
MailService.sendMail(emailMessage, {
|
|
296
297
|
userOnCallLogTimelineId: updatedLog.id!,
|
|
297
298
|
projectId: options.projectId,
|
|
299
|
+
alertId: alert.id!,
|
|
300
|
+
userId: notificationRuleItem.userId!,
|
|
301
|
+
onCallPolicyId: options.onCallPolicyId,
|
|
302
|
+
onCallPolicyEscalationRuleId: options.onCallPolicyEscalationRuleId,
|
|
303
|
+
teamId: options.userBelongsToTeamId,
|
|
304
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
305
|
+
options.onCallDutyPolicyExecutionLogTimelineId,
|
|
306
|
+
onCallScheduleId: options.onCallScheduleId,
|
|
298
307
|
}).catch(async (err: Error) => {
|
|
299
308
|
await UserOnCallLogTimelineService.updateOneById({
|
|
300
309
|
id: updatedLog.id!,
|
|
@@ -340,6 +349,14 @@ export class Service extends DatabaseService<Model> {
|
|
|
340
349
|
MailService.sendMail(emailMessage, {
|
|
341
350
|
userOnCallLogTimelineId: updatedLog.id!,
|
|
342
351
|
projectId: options.projectId,
|
|
352
|
+
incidentId: incident.id!,
|
|
353
|
+
userId: notificationRuleItem.userId!,
|
|
354
|
+
onCallPolicyId: options.onCallPolicyId,
|
|
355
|
+
onCallPolicyEscalationRuleId: options.onCallPolicyEscalationRuleId,
|
|
356
|
+
teamId: options.userBelongsToTeamId,
|
|
357
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
358
|
+
options.onCallDutyPolicyExecutionLogTimelineId,
|
|
359
|
+
onCallScheduleId: options.onCallScheduleId,
|
|
343
360
|
}).catch(async (err: Error) => {
|
|
344
361
|
await UserOnCallLogTimelineService.updateOneById({
|
|
345
362
|
id: updatedLog.id!,
|
|
@@ -402,11 +419,19 @@ export class Service extends DatabaseService<Model> {
|
|
|
402
419
|
updatedLog.id!,
|
|
403
420
|
);
|
|
404
421
|
|
|
405
|
-
// send
|
|
422
|
+
// send sms.
|
|
406
423
|
|
|
407
424
|
SmsService.sendSms(smsMessage, {
|
|
408
425
|
projectId: alert.projectId,
|
|
409
426
|
userOnCallLogTimelineId: updatedLog.id!,
|
|
427
|
+
alertId: alert.id!,
|
|
428
|
+
userId: notificationRuleItem.userId!,
|
|
429
|
+
onCallPolicyId: options.onCallPolicyId,
|
|
430
|
+
onCallPolicyEscalationRuleId: options.onCallPolicyEscalationRuleId,
|
|
431
|
+
teamId: options.userBelongsToTeamId,
|
|
432
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
433
|
+
options.onCallDutyPolicyExecutionLogTimelineId,
|
|
434
|
+
onCallScheduleId: options.onCallScheduleId,
|
|
410
435
|
}).catch(async (err: Error) => {
|
|
411
436
|
await UserOnCallLogTimelineService.updateOneById({
|
|
412
437
|
id: updatedLog.id!,
|
|
@@ -447,11 +472,19 @@ export class Service extends DatabaseService<Model> {
|
|
|
447
472
|
updatedLog.id!,
|
|
448
473
|
);
|
|
449
474
|
|
|
450
|
-
// send
|
|
475
|
+
// send sms.
|
|
451
476
|
|
|
452
477
|
SmsService.sendSms(smsMessage, {
|
|
453
478
|
projectId: incident.projectId,
|
|
454
479
|
userOnCallLogTimelineId: updatedLog.id!,
|
|
480
|
+
incidentId: incident.id!,
|
|
481
|
+
userId: notificationRuleItem.userId!,
|
|
482
|
+
onCallPolicyId: options.onCallPolicyId,
|
|
483
|
+
onCallPolicyEscalationRuleId: options.onCallPolicyEscalationRuleId,
|
|
484
|
+
teamId: options.userBelongsToTeamId,
|
|
485
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
486
|
+
options.onCallDutyPolicyExecutionLogTimelineId,
|
|
487
|
+
onCallScheduleId: options.onCallScheduleId,
|
|
455
488
|
}).catch(async (err: Error) => {
|
|
456
489
|
await UserOnCallLogTimelineService.updateOneById({
|
|
457
490
|
id: updatedLog.id!,
|
|
@@ -514,11 +547,19 @@ export class Service extends DatabaseService<Model> {
|
|
|
514
547
|
updatedLog.id!,
|
|
515
548
|
);
|
|
516
549
|
|
|
517
|
-
// send
|
|
550
|
+
// send call.
|
|
518
551
|
|
|
519
552
|
CallService.makeCall(callRequest, {
|
|
520
553
|
projectId: alert.projectId,
|
|
521
554
|
userOnCallLogTimelineId: updatedLog.id!,
|
|
555
|
+
alertId: alert.id!,
|
|
556
|
+
userId: notificationRuleItem.userId!,
|
|
557
|
+
onCallPolicyId: options.onCallPolicyId,
|
|
558
|
+
onCallPolicyEscalationRuleId: options.onCallPolicyEscalationRuleId,
|
|
559
|
+
teamId: options.userBelongsToTeamId,
|
|
560
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
561
|
+
options.onCallDutyPolicyExecutionLogTimelineId,
|
|
562
|
+
onCallScheduleId: options.onCallScheduleId,
|
|
522
563
|
}).catch(async (err: Error) => {
|
|
523
564
|
await UserOnCallLogTimelineService.updateOneById({
|
|
524
565
|
id: updatedLog.id!,
|
|
@@ -558,11 +599,19 @@ export class Service extends DatabaseService<Model> {
|
|
|
558
599
|
updatedLog.id!,
|
|
559
600
|
);
|
|
560
601
|
|
|
561
|
-
// send
|
|
602
|
+
// send call.
|
|
562
603
|
|
|
563
604
|
CallService.makeCall(callRequest, {
|
|
564
605
|
projectId: incident.projectId,
|
|
565
606
|
userOnCallLogTimelineId: updatedLog.id!,
|
|
607
|
+
incidentId: incident.id!,
|
|
608
|
+
userId: notificationRuleItem.userId!,
|
|
609
|
+
onCallPolicyId: options.onCallPolicyId,
|
|
610
|
+
onCallPolicyEscalationRuleId: options.onCallPolicyEscalationRuleId,
|
|
611
|
+
teamId: options.userBelongsToTeamId,
|
|
612
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
613
|
+
options.onCallDutyPolicyExecutionLogTimelineId,
|
|
614
|
+
onCallScheduleId: options.onCallScheduleId,
|
|
566
615
|
}).catch(async (err: Error) => {
|
|
567
616
|
await UserOnCallLogTimelineService.updateOneById({
|
|
568
617
|
id: updatedLog.id!,
|
|
@@ -633,13 +682,28 @@ export class Service extends DatabaseService<Model> {
|
|
|
633
682
|
// send push notification.
|
|
634
683
|
PushNotificationService.sendPushNotification(
|
|
635
684
|
{
|
|
636
|
-
|
|
685
|
+
devices: [
|
|
686
|
+
{
|
|
687
|
+
token: notificationRuleItem.userPush.deviceToken!,
|
|
688
|
+
...(notificationRuleItem.userPush.deviceName && {
|
|
689
|
+
name: notificationRuleItem.userPush.deviceName,
|
|
690
|
+
}),
|
|
691
|
+
},
|
|
692
|
+
],
|
|
637
693
|
message: pushMessage,
|
|
638
694
|
deviceType: notificationRuleItem.userPush.deviceType!,
|
|
639
695
|
},
|
|
640
696
|
{
|
|
641
697
|
projectId: options.projectId,
|
|
642
698
|
userOnCallLogTimelineId: updatedLog.id!,
|
|
699
|
+
alertId: alert.id!,
|
|
700
|
+
userId: notificationRuleItem.userId!,
|
|
701
|
+
onCallPolicyId: options.onCallPolicyId,
|
|
702
|
+
onCallPolicyEscalationRuleId: options.onCallPolicyEscalationRuleId,
|
|
703
|
+
teamId: options.userBelongsToTeamId,
|
|
704
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
705
|
+
options.onCallDutyPolicyExecutionLogTimelineId,
|
|
706
|
+
onCallScheduleId: options.onCallScheduleId,
|
|
643
707
|
},
|
|
644
708
|
).catch(async (err: Error) => {
|
|
645
709
|
await UserOnCallLogTimelineService.updateOneById({
|
|
@@ -689,13 +753,28 @@ export class Service extends DatabaseService<Model> {
|
|
|
689
753
|
// send push notification.
|
|
690
754
|
PushNotificationService.sendPushNotification(
|
|
691
755
|
{
|
|
692
|
-
|
|
756
|
+
devices: [
|
|
757
|
+
{
|
|
758
|
+
token: notificationRuleItem.userPush.deviceToken!,
|
|
759
|
+
...(notificationRuleItem.userPush.deviceName && {
|
|
760
|
+
name: notificationRuleItem.userPush.deviceName,
|
|
761
|
+
}),
|
|
762
|
+
},
|
|
763
|
+
],
|
|
693
764
|
message: pushMessage,
|
|
694
765
|
deviceType: notificationRuleItem.userPush.deviceType!,
|
|
695
766
|
},
|
|
696
767
|
{
|
|
697
768
|
projectId: options.projectId,
|
|
698
769
|
userOnCallLogTimelineId: updatedLog.id!,
|
|
770
|
+
incidentId: incident.id!,
|
|
771
|
+
userId: notificationRuleItem.userId!,
|
|
772
|
+
onCallPolicyId: options.onCallPolicyId,
|
|
773
|
+
onCallPolicyEscalationRuleId: options.onCallPolicyEscalationRuleId,
|
|
774
|
+
teamId: options.userBelongsToTeamId,
|
|
775
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
776
|
+
options.onCallDutyPolicyExecutionLogTimelineId,
|
|
777
|
+
onCallScheduleId: options.onCallScheduleId,
|
|
699
778
|
},
|
|
700
779
|
).catch(async (err: Error) => {
|
|
701
780
|
await UserOnCallLogTimelineService.updateOneById({
|
|
@@ -39,6 +39,17 @@ export class Service extends DatabaseService<UserNotificationSetting> {
|
|
|
39
39
|
smsMessage: SMSMessage;
|
|
40
40
|
callRequestMessage: CallRequestMessage;
|
|
41
41
|
pushNotificationMessage: PushNotificationMessage;
|
|
42
|
+
incidentId?: ObjectID | undefined;
|
|
43
|
+
alertId?: ObjectID | undefined;
|
|
44
|
+
scheduledMaintenanceId?: ObjectID | undefined;
|
|
45
|
+
statusPageId?: ObjectID | undefined;
|
|
46
|
+
statusPageAnnouncementId?: ObjectID | undefined;
|
|
47
|
+
teamId?: ObjectID | undefined;
|
|
48
|
+
// OnCall-related fields
|
|
49
|
+
onCallPolicyId?: ObjectID | undefined;
|
|
50
|
+
onCallPolicyEscalationRuleId?: ObjectID | undefined;
|
|
51
|
+
onCallDutyPolicyExecutionLogTimelineId?: ObjectID | undefined;
|
|
52
|
+
onCallScheduleId?: ObjectID | undefined;
|
|
42
53
|
}): Promise<void> {
|
|
43
54
|
if (!data.projectId) {
|
|
44
55
|
throw new BadDataException(
|
|
@@ -91,6 +102,19 @@ export class Service extends DatabaseService<UserNotificationSetting> {
|
|
|
91
102
|
},
|
|
92
103
|
{
|
|
93
104
|
projectId: data.projectId,
|
|
105
|
+
incidentId: data.incidentId,
|
|
106
|
+
alertId: data.alertId,
|
|
107
|
+
scheduledMaintenanceId: data.scheduledMaintenanceId,
|
|
108
|
+
statusPageId: data.statusPageId,
|
|
109
|
+
statusPageAnnouncementId: data.statusPageAnnouncementId,
|
|
110
|
+
userId: data.userId,
|
|
111
|
+
teamId: data.teamId,
|
|
112
|
+
// OnCall-related fields
|
|
113
|
+
onCallPolicyId: data.onCallPolicyId,
|
|
114
|
+
onCallPolicyEscalationRuleId: data.onCallPolicyEscalationRuleId,
|
|
115
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
116
|
+
data.onCallDutyPolicyExecutionLogTimelineId,
|
|
117
|
+
onCallScheduleId: data.onCallScheduleId,
|
|
94
118
|
},
|
|
95
119
|
).catch((err: Error) => {
|
|
96
120
|
logger.error(err);
|
|
@@ -123,6 +147,19 @@ export class Service extends DatabaseService<UserNotificationSetting> {
|
|
|
123
147
|
},
|
|
124
148
|
{
|
|
125
149
|
projectId: data.projectId,
|
|
150
|
+
incidentId: data.incidentId,
|
|
151
|
+
alertId: data.alertId,
|
|
152
|
+
scheduledMaintenanceId: data.scheduledMaintenanceId,
|
|
153
|
+
statusPageId: data.statusPageId,
|
|
154
|
+
statusPageAnnouncementId: data.statusPageAnnouncementId,
|
|
155
|
+
userId: data.userId,
|
|
156
|
+
teamId: data.teamId,
|
|
157
|
+
// OnCall-related fields
|
|
158
|
+
onCallPolicyId: data.onCallPolicyId,
|
|
159
|
+
onCallPolicyEscalationRuleId: data.onCallPolicyEscalationRuleId,
|
|
160
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
161
|
+
data.onCallDutyPolicyExecutionLogTimelineId,
|
|
162
|
+
onCallScheduleId: data.onCallScheduleId,
|
|
126
163
|
},
|
|
127
164
|
).catch((err: Error) => {
|
|
128
165
|
logger.error(err);
|
|
@@ -155,6 +192,19 @@ export class Service extends DatabaseService<UserNotificationSetting> {
|
|
|
155
192
|
},
|
|
156
193
|
{
|
|
157
194
|
projectId: data.projectId,
|
|
195
|
+
incidentId: data.incidentId,
|
|
196
|
+
alertId: data.alertId,
|
|
197
|
+
scheduledMaintenanceId: data.scheduledMaintenanceId,
|
|
198
|
+
statusPageId: data.statusPageId,
|
|
199
|
+
statusPageAnnouncementId: data.statusPageAnnouncementId,
|
|
200
|
+
userId: data.userId,
|
|
201
|
+
teamId: data.teamId,
|
|
202
|
+
// OnCall-related fields
|
|
203
|
+
onCallPolicyId: data.onCallPolicyId,
|
|
204
|
+
onCallPolicyEscalationRuleId: data.onCallPolicyEscalationRuleId,
|
|
205
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
206
|
+
data.onCallDutyPolicyExecutionLogTimelineId,
|
|
207
|
+
onCallScheduleId: data.onCallScheduleId,
|
|
158
208
|
},
|
|
159
209
|
).catch((err: Error) => {
|
|
160
210
|
logger.error(err);
|
|
@@ -172,6 +222,14 @@ export class Service extends DatabaseService<UserNotificationSetting> {
|
|
|
172
222
|
data.pushNotificationMessage,
|
|
173
223
|
{
|
|
174
224
|
projectId: data.projectId,
|
|
225
|
+
userId: data.userId,
|
|
226
|
+
teamId: data.teamId,
|
|
227
|
+
// OnCall-related fields
|
|
228
|
+
onCallPolicyId: data.onCallPolicyId,
|
|
229
|
+
onCallPolicyEscalationRuleId: data.onCallPolicyEscalationRuleId,
|
|
230
|
+
onCallDutyPolicyExecutionLogTimelineId:
|
|
231
|
+
data.onCallDutyPolicyExecutionLogTimelineId,
|
|
232
|
+
onCallScheduleId: data.onCallScheduleId,
|
|
175
233
|
},
|
|
176
234
|
).catch((err: Error) => {
|
|
177
235
|
logger.error(err);
|
|
@@ -250,6 +250,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
250
250
|
userBelongsToTeamId: createdItem.userBelongsToTeamId,
|
|
251
251
|
onCallDutyPolicyExecutionLogTimelineId:
|
|
252
252
|
createdItem.onCallDutyPolicyExecutionLogTimelineId,
|
|
253
|
+
onCallScheduleId: createdItem.onCallDutyScheduleId,
|
|
253
254
|
},
|
|
254
255
|
);
|
|
255
256
|
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { IsBillingEnabled } from "../EnvironmentConfig";
|
|
2
|
+
import DatabaseService from "./DatabaseService";
|
|
3
|
+
import Model from "../../Models/DatabaseModels/WorkspaceNotificationLog";
|
|
4
|
+
import WorkspaceNotificationStatus from "../../Types/Workspace/WorkspaceNotificationStatus";
|
|
5
|
+
import WorkspaceNotificationActionType from "../../Types/Workspace/WorkspaceNotificationActionType";
|
|
6
|
+
import WorkspaceType from "../../Types/Workspace/WorkspaceType";
|
|
7
|
+
import ObjectID from "../../Types/ObjectID";
|
|
8
|
+
import DatabaseCommonInteractionProps from "../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
9
|
+
|
|
10
|
+
export interface WorkspaceLogData {
|
|
11
|
+
projectId: ObjectID;
|
|
12
|
+
workspaceType: WorkspaceType;
|
|
13
|
+
channelId?: string | undefined;
|
|
14
|
+
channelName?: string | undefined;
|
|
15
|
+
threadId?: string | undefined;
|
|
16
|
+
message?: string | undefined;
|
|
17
|
+
actionType: WorkspaceNotificationActionType;
|
|
18
|
+
status: WorkspaceNotificationStatus;
|
|
19
|
+
statusMessage?: string | undefined;
|
|
20
|
+
|
|
21
|
+
// Relations to resources (optional)
|
|
22
|
+
incidentId?: ObjectID | undefined;
|
|
23
|
+
alertId?: ObjectID | undefined;
|
|
24
|
+
scheduledMaintenanceId?: ObjectID | undefined;
|
|
25
|
+
userId?: ObjectID | undefined;
|
|
26
|
+
teamId?: ObjectID | undefined;
|
|
27
|
+
onCallDutyPolicyId?: ObjectID | undefined;
|
|
28
|
+
onCallDutyPolicyEscalationRuleId?: ObjectID | undefined;
|
|
29
|
+
onCallDutyPolicyScheduleId?: ObjectID | undefined;
|
|
30
|
+
statusPageId?: ObjectID | undefined;
|
|
31
|
+
statusPageAnnouncementId?: ObjectID | undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class Service extends DatabaseService<Model> {
|
|
35
|
+
public constructor() {
|
|
36
|
+
super(Model);
|
|
37
|
+
if (IsBillingEnabled) {
|
|
38
|
+
this.hardDeleteItemsOlderThanInDays("createdAt", 3);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public async createWorkspaceLog(
|
|
43
|
+
data: WorkspaceLogData,
|
|
44
|
+
props: DatabaseCommonInteractionProps,
|
|
45
|
+
): Promise<Model> {
|
|
46
|
+
const log: Model = new Model();
|
|
47
|
+
|
|
48
|
+
// Required fields
|
|
49
|
+
log.projectId = data.projectId;
|
|
50
|
+
log.workspaceType = data.workspaceType;
|
|
51
|
+
log.actionType = data.actionType;
|
|
52
|
+
log.status = data.status;
|
|
53
|
+
|
|
54
|
+
// Optional fields
|
|
55
|
+
if (data.channelId) {
|
|
56
|
+
log.channelId = data.channelId;
|
|
57
|
+
}
|
|
58
|
+
if (data.channelName) {
|
|
59
|
+
log.channelName = data.channelName;
|
|
60
|
+
}
|
|
61
|
+
if (data.threadId) {
|
|
62
|
+
log.threadId = data.threadId;
|
|
63
|
+
}
|
|
64
|
+
if (data.message) {
|
|
65
|
+
log.message = data.message;
|
|
66
|
+
}
|
|
67
|
+
if (data.statusMessage) {
|
|
68
|
+
log.statusMessage = data.statusMessage;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Resource relations
|
|
72
|
+
if (data.incidentId) {
|
|
73
|
+
log.incidentId = data.incidentId;
|
|
74
|
+
}
|
|
75
|
+
if (data.alertId) {
|
|
76
|
+
log.alertId = data.alertId;
|
|
77
|
+
}
|
|
78
|
+
if (data.scheduledMaintenanceId) {
|
|
79
|
+
log.scheduledMaintenanceId = data.scheduledMaintenanceId;
|
|
80
|
+
}
|
|
81
|
+
if (data.userId) {
|
|
82
|
+
log.userId = data.userId;
|
|
83
|
+
}
|
|
84
|
+
if (data.teamId) {
|
|
85
|
+
log.teamId = data.teamId;
|
|
86
|
+
}
|
|
87
|
+
if (data.onCallDutyPolicyId) {
|
|
88
|
+
log.onCallDutyPolicyId = data.onCallDutyPolicyId;
|
|
89
|
+
}
|
|
90
|
+
if (data.onCallDutyPolicyEscalationRuleId) {
|
|
91
|
+
log.onCallDutyPolicyEscalationRuleId =
|
|
92
|
+
data.onCallDutyPolicyEscalationRuleId;
|
|
93
|
+
}
|
|
94
|
+
if (data.onCallDutyPolicyScheduleId) {
|
|
95
|
+
log.onCallDutyPolicyScheduleId = data.onCallDutyPolicyScheduleId;
|
|
96
|
+
}
|
|
97
|
+
if (data.statusPageId) {
|
|
98
|
+
log.statusPageId = data.statusPageId;
|
|
99
|
+
}
|
|
100
|
+
if (data.statusPageAnnouncementId) {
|
|
101
|
+
log.statusPageAnnouncementId = data.statusPageAnnouncementId;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return await this.create({
|
|
105
|
+
data: log,
|
|
106
|
+
props,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
public async logCreateChannel(
|
|
111
|
+
data: {
|
|
112
|
+
projectId: ObjectID;
|
|
113
|
+
workspaceType: WorkspaceType;
|
|
114
|
+
channelId: string;
|
|
115
|
+
channelName: string;
|
|
116
|
+
// Optional resource associations
|
|
117
|
+
incidentId?: ObjectID;
|
|
118
|
+
alertId?: ObjectID;
|
|
119
|
+
scheduledMaintenanceId?: ObjectID;
|
|
120
|
+
onCallDutyPolicyId?: ObjectID;
|
|
121
|
+
statusPageId?: ObjectID;
|
|
122
|
+
statusPageAnnouncementId?: ObjectID;
|
|
123
|
+
},
|
|
124
|
+
props: DatabaseCommonInteractionProps,
|
|
125
|
+
): Promise<Model> {
|
|
126
|
+
const logData: WorkspaceLogData = {
|
|
127
|
+
projectId: data.projectId,
|
|
128
|
+
workspaceType: data.workspaceType,
|
|
129
|
+
channelId: data.channelId,
|
|
130
|
+
channelName: data.channelName,
|
|
131
|
+
actionType: WorkspaceNotificationActionType.CreateChannel,
|
|
132
|
+
status: WorkspaceNotificationStatus.Success,
|
|
133
|
+
statusMessage: "Channel created successfully",
|
|
134
|
+
message: `Channel "${data.channelName}" was created`,
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// Add resource associations only if they exist
|
|
138
|
+
if (data.incidentId) {
|
|
139
|
+
logData.incidentId = data.incidentId;
|
|
140
|
+
}
|
|
141
|
+
if (data.alertId) {
|
|
142
|
+
logData.alertId = data.alertId;
|
|
143
|
+
}
|
|
144
|
+
if (data.scheduledMaintenanceId) {
|
|
145
|
+
logData.scheduledMaintenanceId = data.scheduledMaintenanceId;
|
|
146
|
+
}
|
|
147
|
+
if (data.onCallDutyPolicyId) {
|
|
148
|
+
logData.onCallDutyPolicyId = data.onCallDutyPolicyId;
|
|
149
|
+
}
|
|
150
|
+
if (data.statusPageId) {
|
|
151
|
+
logData.statusPageId = data.statusPageId;
|
|
152
|
+
}
|
|
153
|
+
if (data.statusPageAnnouncementId) {
|
|
154
|
+
logData.statusPageAnnouncementId = data.statusPageAnnouncementId;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return await this.createWorkspaceLog(logData, props);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
public async logInviteUser(
|
|
161
|
+
data: {
|
|
162
|
+
projectId: ObjectID;
|
|
163
|
+
workspaceType: WorkspaceType;
|
|
164
|
+
channelId: string;
|
|
165
|
+
channelName: string;
|
|
166
|
+
userId: ObjectID;
|
|
167
|
+
// Optional resource associations
|
|
168
|
+
incidentId?: ObjectID;
|
|
169
|
+
alertId?: ObjectID;
|
|
170
|
+
scheduledMaintenanceId?: ObjectID;
|
|
171
|
+
onCallDutyPolicyId?: ObjectID;
|
|
172
|
+
statusPageId?: ObjectID;
|
|
173
|
+
statusPageAnnouncementId?: ObjectID;
|
|
174
|
+
},
|
|
175
|
+
props: DatabaseCommonInteractionProps,
|
|
176
|
+
): Promise<Model> {
|
|
177
|
+
const logData: WorkspaceLogData = {
|
|
178
|
+
projectId: data.projectId,
|
|
179
|
+
workspaceType: data.workspaceType,
|
|
180
|
+
channelId: data.channelId,
|
|
181
|
+
channelName: data.channelName,
|
|
182
|
+
userId: data.userId,
|
|
183
|
+
actionType: WorkspaceNotificationActionType.InviteUser,
|
|
184
|
+
status: WorkspaceNotificationStatus.Success,
|
|
185
|
+
statusMessage: "User invited to channel successfully",
|
|
186
|
+
message: `User was invited to channel "${data.channelName}"`,
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// Add resource associations only if they exist
|
|
190
|
+
if (data.incidentId) {
|
|
191
|
+
logData.incidentId = data.incidentId;
|
|
192
|
+
}
|
|
193
|
+
if (data.alertId) {
|
|
194
|
+
logData.alertId = data.alertId;
|
|
195
|
+
}
|
|
196
|
+
if (data.scheduledMaintenanceId) {
|
|
197
|
+
logData.scheduledMaintenanceId = data.scheduledMaintenanceId;
|
|
198
|
+
}
|
|
199
|
+
if (data.onCallDutyPolicyId) {
|
|
200
|
+
logData.onCallDutyPolicyId = data.onCallDutyPolicyId;
|
|
201
|
+
}
|
|
202
|
+
if (data.statusPageId) {
|
|
203
|
+
logData.statusPageId = data.statusPageId;
|
|
204
|
+
}
|
|
205
|
+
if (data.statusPageAnnouncementId) {
|
|
206
|
+
logData.statusPageAnnouncementId = data.statusPageAnnouncementId;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return await this.createWorkspaceLog(logData, props);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
public async logButtonPressed(
|
|
213
|
+
data: {
|
|
214
|
+
projectId: ObjectID;
|
|
215
|
+
workspaceType: WorkspaceType;
|
|
216
|
+
channelId?: string;
|
|
217
|
+
channelName?: string;
|
|
218
|
+
threadId?: string;
|
|
219
|
+
userId: ObjectID;
|
|
220
|
+
buttonAction: string;
|
|
221
|
+
// Optional resource associations
|
|
222
|
+
incidentId?: ObjectID;
|
|
223
|
+
alertId?: ObjectID;
|
|
224
|
+
scheduledMaintenanceId?: ObjectID;
|
|
225
|
+
onCallDutyPolicyId?: ObjectID;
|
|
226
|
+
statusPageId?: ObjectID;
|
|
227
|
+
statusPageAnnouncementId?: ObjectID;
|
|
228
|
+
},
|
|
229
|
+
props: DatabaseCommonInteractionProps,
|
|
230
|
+
): Promise<Model> {
|
|
231
|
+
const logData: WorkspaceLogData = {
|
|
232
|
+
projectId: data.projectId,
|
|
233
|
+
workspaceType: data.workspaceType,
|
|
234
|
+
userId: data.userId,
|
|
235
|
+
actionType: WorkspaceNotificationActionType.ButtonPressed,
|
|
236
|
+
status: WorkspaceNotificationStatus.Success,
|
|
237
|
+
statusMessage: "Button interaction completed",
|
|
238
|
+
message: `User pressed button: ${data.buttonAction}`,
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
// Add optional properties only if they exist
|
|
242
|
+
if (data.channelId) {
|
|
243
|
+
logData.channelId = data.channelId;
|
|
244
|
+
}
|
|
245
|
+
if (data.channelName) {
|
|
246
|
+
logData.channelName = data.channelName;
|
|
247
|
+
}
|
|
248
|
+
if (data.threadId) {
|
|
249
|
+
logData.threadId = data.threadId;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Add resource associations only if they exist
|
|
253
|
+
if (data.incidentId) {
|
|
254
|
+
logData.incidentId = data.incidentId;
|
|
255
|
+
}
|
|
256
|
+
if (data.alertId) {
|
|
257
|
+
logData.alertId = data.alertId;
|
|
258
|
+
}
|
|
259
|
+
if (data.scheduledMaintenanceId) {
|
|
260
|
+
logData.scheduledMaintenanceId = data.scheduledMaintenanceId;
|
|
261
|
+
}
|
|
262
|
+
if (data.onCallDutyPolicyId) {
|
|
263
|
+
logData.onCallDutyPolicyId = data.onCallDutyPolicyId;
|
|
264
|
+
}
|
|
265
|
+
if (data.statusPageId) {
|
|
266
|
+
logData.statusPageId = data.statusPageId;
|
|
267
|
+
}
|
|
268
|
+
if (data.statusPageAnnouncementId) {
|
|
269
|
+
logData.statusPageAnnouncementId = data.statusPageAnnouncementId;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return await this.createWorkspaceLog(logData, props);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export default new Service();
|