@@ -43,7 +43,7 @@ export class Service extends DatabaseService<Model> {
43
43
projectId : ObjectID ;
44
44
} ) : Promise < ObjectID | null > {
45
45
logger . debug (
46
- `Getting route alert to user id for userId: ${ data . userId . toString ( ) } `
46
+ `Getting route alert to user id for userId: ${ data . userId . toString ( ) } ` ,
47
47
) ;
48
48
49
49
const currentDate : Date = OneUptimeDate . getCurrentDate ( ) ;
@@ -53,7 +53,7 @@ export class Service extends DatabaseService<Model> {
53
53
query : {
54
54
overrideUserId : data . userId ,
55
55
onCallDutyPolicyId : QueryHelper . equalToOrNull (
56
- data . onCallDutyPolicyId
56
+ data . onCallDutyPolicyId ,
57
57
) , // find global overrides as well. If this is null, then it will find global overrides.
58
58
projectId : data . projectId ,
59
59
startsAt : QueryHelper . lessThanEqualTo ( currentDate ) ,
@@ -83,7 +83,7 @@ export class Service extends DatabaseService<Model> {
83
83
84
84
if ( localOverride && localOverride . routeAlertsToUserId ) {
85
85
logger . debug (
86
- `Route alert to user id found: ${ localOverride . routeAlertsToUserId . toString ( ) } `
86
+ `Route alert to user id found: ${ localOverride . routeAlertsToUserId . toString ( ) } ` ,
87
87
) ;
88
88
return localOverride . routeAlertsToUserId ;
89
89
}
@@ -95,7 +95,7 @@ export class Service extends DatabaseService<Model> {
95
95
96
96
if ( globalOverride && globalOverride . routeAlertsToUserId ) {
97
97
logger . debug (
98
- `Route alert to user id found: ${ globalOverride . routeAlertsToUserId . toString ( ) } `
98
+ `Route alert to user id found: ${ globalOverride . routeAlertsToUserId . toString ( ) } ` ,
99
99
) ;
100
100
return globalOverride . routeAlertsToUserId ;
101
101
}
@@ -113,7 +113,7 @@ export class Service extends DatabaseService<Model> {
113
113
userNotificationEventType : UserNotificationEventType ;
114
114
onCallPolicyExecutionLogId : ObjectID ;
115
115
onCallPolicyId : ObjectID ;
116
- }
116
+ } ,
117
117
) : Promise < void > {
118
118
logger . debug ( `Starting rule execution for ruleId: ${ ruleId . toString ( ) } ` ) ;
119
119
@@ -131,7 +131,7 @@ export class Service extends DatabaseService<Model> {
131
131
132
132
if ( ! rule ) {
133
133
throw new BadDataException (
134
- `On-Call Duty Policy Escalation Rule with id ${ ruleId . toString ( ) } not found`
134
+ `On-Call Duty Policy Escalation Rule with id ${ ruleId . toString ( ) } not found` ,
135
135
) ;
136
136
}
137
137
@@ -182,7 +182,7 @@ export class Service extends DatabaseService<Model> {
182
182
! options . triggeredByIncidentId
183
183
) {
184
184
throw new BadDataException (
185
- "triggeredByIncidentId is required when userNotificationEventType is IncidentCreated"
185
+ "triggeredByIncidentId is required when userNotificationEventType is IncidentCreated" ,
186
186
) ;
187
187
}
188
188
@@ -192,7 +192,7 @@ export class Service extends DatabaseService<Model> {
192
192
! options . triggeredByAlertId
193
193
) {
194
194
throw new BadDataException (
195
- "triggeredByAlertId is required when userNotificationEventType is IncidentCreated"
195
+ "triggeredByAlertId is required when userNotificationEventType is IncidentCreated" ,
196
196
) ;
197
197
}
198
198
@@ -250,14 +250,14 @@ export class Service extends DatabaseService<Model> {
250
250
type StartUserNotificationRuleExecutionFunction = (
251
251
userId : ObjectID ,
252
252
teamId : ObjectID | null ,
253
- scheduleId : ObjectID | null
253
+ scheduleId : ObjectID | null ,
254
254
) => Promise < void > ;
255
255
256
256
const startUserNotificationRuleExecution : StartUserNotificationRuleExecutionFunction =
257
257
async (
258
258
userId : ObjectID ,
259
259
teamId : ObjectID | null ,
260
- scheduleId : ObjectID | null
260
+ scheduleId : ObjectID | null ,
261
261
) : Promise < void > => {
262
262
// This is where user is notified.
263
263
@@ -275,7 +275,7 @@ export class Service extends DatabaseService<Model> {
275
275
const alertSentToUserId : ObjectID = routeAlertToUserId || userId ;
276
276
277
277
logger . debug (
278
- `Starting notification rule execution for userId: ${ alertSentToUserId . toString ( ) } `
278
+ `Starting notification rule execution for userId: ${ alertSentToUserId . toString ( ) } ` ,
279
279
) ;
280
280
let log : OnCallDutyPolicyExecutionLogTimeline = getNewLog ( ) ;
281
281
log . statusMessage = "Sending notification to user." ;
@@ -315,15 +315,15 @@ export class Service extends DatabaseService<Model> {
315
315
projectId : options . projectId ,
316
316
onCallScheduleId : scheduleId || undefined ,
317
317
overridedByUserId : routeAlertToUserId ? userId : undefined ,
318
- }
318
+ } ,
319
319
) ;
320
320
} ;
321
321
322
322
const uniqueUserIds : Array < ObjectID > = [ ] ;
323
323
324
324
for ( const teamInRule of teamsInRule ) {
325
325
const usersInTeam : Array < User > = await TeamMemberService . getUsersInTeam (
326
- teamInRule . teamId !
326
+ teamInRule . teamId ! ,
327
327
) ;
328
328
329
329
for ( const user of usersInTeam ) {
@@ -336,7 +336,7 @@ export class Service extends DatabaseService<Model> {
336
336
await startUserNotificationRuleExecution (
337
337
user . id ! ,
338
338
teamInRule . teamId ! ,
339
- null
339
+ null ,
340
340
) ;
341
341
} else {
342
342
const log : OnCallDutyPolicyExecutionLogTimeline = getNewLog ( ) ;
@@ -383,7 +383,7 @@ export class Service extends DatabaseService<Model> {
383
383
for ( const scheduleRule of schedulesInRule ) {
384
384
const userIdInSchedule : ObjectID | null =
385
385
await OnCallDutyPolicyScheduleService . getCurrentUserIdInSchedule (
386
- scheduleRule . onCallDutyPolicyScheduleId !
386
+ scheduleRule . onCallDutyPolicyScheduleId ! ,
387
387
) ;
388
388
389
389
if ( ! userIdInSchedule ) {
@@ -412,7 +412,7 @@ export class Service extends DatabaseService<Model> {
412
412
await startUserNotificationRuleExecution (
413
413
userIdInSchedule ,
414
414
null ,
415
- scheduleRule . onCallDutyPolicyScheduleId !
415
+ scheduleRule . onCallDutyPolicyScheduleId ! ,
416
416
) ;
417
417
} else {
418
418
const log : OnCallDutyPolicyExecutionLogTimeline = getNewLog ( ) ;
@@ -454,7 +454,7 @@ export class Service extends DatabaseService<Model> {
454
454
@CaptureSpan ( )
455
455
protected override async onCreateSuccess (
456
456
onCreate : OnCreate < Model > ,
457
- createdItem : Model
457
+ createdItem : Model ,
458
458
) : Promise < Model > {
459
459
if ( ! createdItem . projectId ) {
460
460
throw new BadDataException ( "projectId is required" ) ;
@@ -481,7 +481,7 @@ export class Service extends DatabaseService<Model> {
481
481
( onCreate . createBy . miscDataProps [
482
482
"onCallSchedules"
483
483
] as Array < ObjectID > ) || [ ] ,
484
- onCreate . createBy . props
484
+ onCreate . createBy . props ,
485
485
) ;
486
486
}
487
487
@@ -496,15 +496,15 @@ export class Service extends DatabaseService<Model> {
496
496
usersIds : Array < ObjectID > ,
497
497
teamIds : Array < ObjectID > ,
498
498
onCallScheduleIds : Array < ObjectID > ,
499
- props : DatabaseCommonInteractionProps
499
+ props : DatabaseCommonInteractionProps ,
500
500
) : Promise < void > {
501
501
for ( const userId of usersIds ) {
502
502
await this . addUser (
503
503
projectId ,
504
504
escalationRuleId ,
505
505
onCallDutyPolicyId ,
506
506
userId ,
507
- props
507
+ props ,
508
508
) ;
509
509
}
510
510
@@ -514,7 +514,7 @@ export class Service extends DatabaseService<Model> {
514
514
escalationRuleId ,
515
515
onCallDutyPolicyId ,
516
516
teamId ,
517
- props
517
+ props ,
518
518
) ;
519
519
}
520
520
@@ -524,7 +524,7 @@ export class Service extends DatabaseService<Model> {
524
524
escalationRuleId ,
525
525
onCallDutyPolicyId ,
526
526
scheduleId ,
527
- props
527
+ props ,
528
528
) ;
529
529
}
530
530
}
@@ -535,7 +535,7 @@ export class Service extends DatabaseService<Model> {
535
535
escalationRuleId : ObjectID ,
536
536
onCallDutyPolicyId : ObjectID ,
537
537
teamId : ObjectID ,
538
- props : DatabaseCommonInteractionProps
538
+ props : DatabaseCommonInteractionProps ,
539
539
) : Promise < void > {
540
540
const teamInRule : OnCallDutyPolicyEscalationRuleTeam =
541
541
new OnCallDutyPolicyEscalationRuleTeam ( ) ;
@@ -556,7 +556,7 @@ export class Service extends DatabaseService<Model> {
556
556
escalationRuleId : ObjectID ,
557
557
onCallDutyPolicyId : ObjectID ,
558
558
onCallScheduleId : ObjectID ,
559
- props : DatabaseCommonInteractionProps
559
+ props : DatabaseCommonInteractionProps ,
560
560
) : Promise < void > {
561
561
const scheduleInRule : OnCallDutyPolicyEscalationRuleSchedule =
562
562
new OnCallDutyPolicyEscalationRuleSchedule ( ) ;
@@ -577,7 +577,7 @@ export class Service extends DatabaseService<Model> {
577
577
escalationRuleId : ObjectID ,
578
578
onCallDutyPolicyId : ObjectID ,
579
579
userId : ObjectID ,
580
- props : DatabaseCommonInteractionProps
580
+ props : DatabaseCommonInteractionProps ,
581
581
) : Promise < void > {
582
582
const userInRule : OnCallDutyPolicyEscalationRuleUser =
583
583
new OnCallDutyPolicyEscalationRuleUser ( ) ;
@@ -594,7 +594,7 @@ export class Service extends DatabaseService<Model> {
594
594
595
595
@CaptureSpan ( )
596
596
protected override async onBeforeCreate (
597
- createBy : CreateBy < Model >
597
+ createBy : CreateBy < Model > ,
598
598
) : Promise < OnCreate < Model > > {
599
599
if ( IsBillingEnabled && createBy . props . currentPlan === PlanType . Free ) {
600
600
// then check no of policies and if it is more than one, return error
@@ -612,14 +612,14 @@ export class Service extends DatabaseService<Model> {
612
612
613
613
if ( count . toNumber ( ) >= 1 ) {
614
614
throw new BadDataException (
615
- "You can only create one escalation rule in free plan."
615
+ "You can only create one escalation rule in free plan." ,
616
616
) ;
617
617
}
618
618
}
619
619
620
620
if ( ! createBy . data . onCallDutyPolicyId ) {
621
621
throw new BadDataException (
622
- "Status Page Resource onCallDutyPolicyId is required"
622
+ "Status Page Resource onCallDutyPolicyId is required" ,
623
623
) ;
624
624
}
625
625
@@ -641,7 +641,7 @@ export class Service extends DatabaseService<Model> {
641
641
await this . rearrangeOrder (
642
642
createBy . data . order ,
643
643
createBy . data . onCallDutyPolicyId ,
644
- true
644
+ true ,
645
645
) ;
646
646
647
647
return {
@@ -652,11 +652,11 @@ export class Service extends DatabaseService<Model> {
652
652
653
653
@CaptureSpan ( )
654
654
protected override async onBeforeDelete (
655
- deleteBy : DeleteBy < Model >
655
+ deleteBy : DeleteBy < Model > ,
656
656
) : Promise < OnDelete < Model > > {
657
657
if ( ! deleteBy . query . _id && ! deleteBy . props . isRoot ) {
658
658
throw new BadDataException (
659
- "_id should be present when deleting status page resource. Please try the delete with objectId"
659
+ "_id should be present when deleting status page resource. Please try the delete with objectId" ,
660
660
) ;
661
661
}
662
662
@@ -677,7 +677,7 @@ export class Service extends DatabaseService<Model> {
677
677
678
678
if ( ! resource ) {
679
679
throw new BadDataException (
680
- "OnCallDutyPolicyEscalationRule with this id not found"
680
+ "OnCallDutyPolicyEscalationRule with this id not found" ,
681
681
) ;
682
682
}
683
683
@@ -730,7 +730,7 @@ export class Service extends DatabaseService<Model> {
730
730
@CaptureSpan ( )
731
731
protected override async onDeleteSuccess (
732
732
onDelete : OnDelete < Model > ,
733
- _itemIdsBeforeDelete : ObjectID [ ]
733
+ _itemIdsBeforeDelete : ObjectID [ ] ,
734
734
) : Promise < OnDelete < Model > > {
735
735
const deleteBy : DeleteBy < Model > = onDelete . deleteBy ;
736
736
const resource : Model | null = onDelete . carryForward ;
@@ -741,7 +741,7 @@ export class Service extends DatabaseService<Model> {
741
741
resource . order ,
742
742
resource . onCallDutyPolicyId ,
743
743
744
- false
744
+ false ,
745
745
) ;
746
746
}
747
747
}
@@ -754,7 +754,7 @@ export class Service extends DatabaseService<Model> {
754
754
755
755
@CaptureSpan ( )
756
756
protected override async onBeforeUpdate (
757
- updateBy : UpdateBy < Model >
757
+ updateBy : UpdateBy < Model > ,
758
758
) : Promise < OnUpdate < Model > > {
759
759
if ( updateBy . data . order && ! updateBy . props . isRoot && updateBy . query . _id ) {
760
760
const resource : Model | null = await this . findOneBy ( {
@@ -842,7 +842,7 @@ export class Service extends DatabaseService<Model> {
842
842
private async rearrangeOrder (
843
843
currentOrder : number ,
844
844
onCallDutyPolicyId : ObjectID ,
845
- increaseOrder : boolean = true
845
+ increaseOrder : boolean = true ,
846
846
) : Promise < void > {
847
847
// get status page resource with this order.
848
848
const resources : Array < Model > = await this . findBy ( {
0 commit comments