File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import { v4 as uuid } from 'uuid';
99 */
1010export enum ReceiveTypes {
1111 /**
12- * All notifications
12+ * Notify if more than n error occurrences in the given period
1313 */
1414 SEEN_MORE = 'SEEN_MORE' ,
1515
Original file line number Diff line number Diff line change 1+ import { ReceiveTypes } from '@hawk.so/types' ;
12import * as telegram from '../utils/telegram' ;
23const mongo = require ( '../mongo' ) ;
34const { ApolloError, UserInputError } = require ( 'apollo-server-express' ) ;
@@ -56,6 +57,33 @@ module.exports = {
5657 } ;
5758
5859 const project = await factories . projectsFactory . create ( options ) ;
60+ const userData = await factories . usersFactory . findById ( user . id ) ;
61+
62+ await project . createNotificationsRule ( {
63+ isEnabled : true ,
64+ whatToReceive : ReceiveTypes . SEEN_MORE ,
65+ including : [ ] ,
66+ excluding : [ ] ,
67+ threshold : 20 ,
68+ thresholdPeriod : 3600000 ,
69+ channels : {
70+ email : {
71+ isEnabled : true ,
72+ endpoint : userData . email ,
73+ minPeriod : 60 ,
74+ } ,
75+ telegram : {
76+ isEnabled : false ,
77+ endpoint : '' ,
78+ minPeriod : 60 ,
79+ } ,
80+ slack : {
81+ isEnabled : false ,
82+ endpoint : '' ,
83+ minPeriod : 60 ,
84+ } ,
85+ } ,
86+ } ) ;
5987
6088 /**
6189 * Create collections for storing events and setup indexes
You can’t perform that action at this time.
0 commit comments