File tree Expand file tree Collapse file tree 4 files changed +14
-8
lines changed
Expand file tree Collapse file tree 4 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " hawk.api" ,
3- "version" : " 1.1.25 " ,
3+ "version" : " 1.1.26 " ,
44 "main" : " index.ts" ,
55 "license" : " UNLICENSED" ,
66 "scripts" : {
3737 "@graphql-tools/schema" : " ^8.5.1" ,
3838 "@graphql-tools/utils" : " ^8.9.0" ,
3939 "@hawk.so/nodejs" : " ^3.1.1" ,
40- "@hawk.so/types" : " ^0.1.28 " ,
40+ "@hawk.so/types" : " ^0.1.31 " ,
4141 "@types/amqp-connection-manager" : " ^2.0.4" ,
4242 "@types/bson" : " ^4.0.5" ,
4343 "@types/debug" : " ^4.1.5" ,
Original file line number Diff line number Diff line change @@ -235,8 +235,9 @@ export default class ProjectModel extends AbstractModel<ProjectDBScheme> impleme
235235 /**
236236 * Creates new notification rule and add it to start of the array of notifications rules
237237 * @param payload - rule data to save
238+ * @param isAutoAdded - true when rule is created automatically (on project creation or conversion of old projects)
238239 */
239- public async createNotificationsRule ( payload : CreateProjectNotificationsRulePayload ) : Promise < ProjectNotificationsRuleDBScheme > {
240+ public async createNotificationsRule ( payload : CreateProjectNotificationsRulePayload , isAutoAdded = false ) : Promise < ProjectNotificationsRuleDBScheme > {
240241 const rule : ProjectNotificationsRuleDBScheme = {
241242 _id : new ObjectId ( ) ,
242243 uidAdded : new ObjectId ( payload . uidAdded ) ,
@@ -247,6 +248,10 @@ export default class ProjectModel extends AbstractModel<ProjectDBScheme> impleme
247248 excluding : payload . excluding ,
248249 } ;
249250
251+ if ( isAutoAdded ) {
252+ rule . autoAdded = '$$NOW' ;
253+ }
254+
250255 if ( rule . whatToReceive === ReceiveTypes . SEEN_MORE ) {
251256 rule . threshold = payload . threshold ;
252257 rule . thresholdPeriod = payload . thresholdPeriod ;
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ module.exports = {
6161
6262 try {
6363 await project . createNotificationsRule ( {
64+ uidAdded : user . id ,
6465 isEnabled : true ,
6566 whatToReceive : ReceiveTypes . SEEN_MORE ,
6667 including : [ ] ,
@@ -84,7 +85,7 @@ module.exports = {
8485 minPeriod : 60 ,
8586 } ,
8687 } ,
87- } ) ;
88+ } , true ) ;
8889
8990 project = await factories . projectsFactory . findById ( project . _id ) ;
9091 } catch ( err ) {
Original file line number Diff line number Diff line change 458458 dependencies :
459459 " @types/mongodb" " ^3.5.34"
460460
461- " @hawk.so/types@^0.1.28 " :
462- version "0.1.28 "
463- resolved "https://registry.yarnpkg.com/@hawk.so/types/-/types-0.1.28 .tgz#a479f411a4ae1855a6661084fa4396c7f323b170 "
464- integrity sha512-W8xNlbkQuffwhVn/ja5Bo4EglN0waSM0Rx3R+jGmcrbYi1a4g6kGPQFYkMSd0WadikOH1nd9NrfmyJB9cVOBWA ==
461+ " @hawk.so/types@^0.1.31 " :
462+ version "0.1.31 "
463+ resolved "https://registry.yarnpkg.com/@hawk.so/types/-/types-0.1.31 .tgz#fba2c3451e927558bfcc3b1d942baaf8e72ad214 "
464+ integrity sha512-o1LeA3JVIUPRSIZegKwAdl4noQ1KYxwr80eisJMlghP9knu6PbYw20rIMyan5qQ3epOWs8gO1CU3iwHZprFiCg ==
465465 dependencies :
466466 " @types/mongodb" " ^3.5.34"
467467
You can’t perform that action at this time.
0 commit comments