|
|
@@ -14,10 +14,15 @@ module.exports = function(crowi) {
|
|
|
|
|
|
/**
|
|
|
* create new notification setting
|
|
|
+ * @param {string} triggerPath
|
|
|
+ * @param {[string]} triggerEvents
|
|
|
+ * @param {string} toEmail
|
|
|
*/
|
|
|
- notificationSchema.statics.create = () => {
|
|
|
- // save
|
|
|
- // return Notification
|
|
|
+ notificationSchema.statics.create = (triggerPath, triggerEvents, toEmail) => {
|
|
|
+ // return new Promise((resolve, reject) => {
|
|
|
+ // save
|
|
|
+ // return resolve(Notification)
|
|
|
+ //}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
@@ -25,8 +30,10 @@ module.exports = function(crowi) {
|
|
|
* @param {string} id
|
|
|
*/
|
|
|
notificationSchema.statics.enable = id => {
|
|
|
- // save
|
|
|
- // return Notification
|
|
|
+ // return new Promise((resolve, reject) => {
|
|
|
+ // save
|
|
|
+ // return resolve(Notification)
|
|
|
+ //}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
@@ -34,8 +41,10 @@ module.exports = function(crowi) {
|
|
|
* @param {string} id
|
|
|
*/
|
|
|
notificationSchema.statics.disable = id => {
|
|
|
- // save
|
|
|
- // return Notification
|
|
|
+ // return new Promise((resolve, reject) => {
|
|
|
+ // save
|
|
|
+ // return resolve(Notification)
|
|
|
+ //}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
@@ -43,9 +52,10 @@ module.exports = function(crowi) {
|
|
|
* @param {string} id
|
|
|
*/
|
|
|
notificationSchema.statics.delete = id => {
|
|
|
- // delete notification setting
|
|
|
- // remove
|
|
|
- // return;
|
|
|
+ // return new Promise((resolve, reject) => {
|
|
|
+ // remove
|
|
|
+ // return resolve()
|
|
|
+ //}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
@@ -53,8 +63,10 @@ module.exports = function(crowi) {
|
|
|
* @param {string} id
|
|
|
*/
|
|
|
notificationSchema.statics.update = id => {
|
|
|
- // save
|
|
|
- // return Notification
|
|
|
+ // return new Promise((resolve, reject) => {
|
|
|
+ // save
|
|
|
+ // return resolve(Notification)
|
|
|
+ //}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
@@ -62,8 +74,10 @@ module.exports = function(crowi) {
|
|
|
* @param {string} id
|
|
|
*/
|
|
|
notificationSchema.statics.findSettingById = id => {
|
|
|
- // findOne
|
|
|
- // return Notification
|
|
|
+ // return new Promise((resolve, reject) => {
|
|
|
+ // findOne
|
|
|
+ // return resolve(Notification)
|
|
|
+ //}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
@@ -72,30 +86,26 @@ module.exports = function(crowi) {
|
|
|
* @param {string} event
|
|
|
*/
|
|
|
notificationSchema.statics.findSettingByPathAndEvent = (path, event) => {
|
|
|
- // find
|
|
|
- // return [Notification]
|
|
|
+ // return new Promise((resolve, reject) => {
|
|
|
+ // find
|
|
|
+ // return resolve([Notification])
|
|
|
+ //}
|
|
|
};
|
|
|
|
|
|
// classify a list of notification settings into enabled and disabled
|
|
|
notificationSchema.mothods.classify = settings => {
|
|
|
- // return {enabled: [Notification], disabled: [Notification]}
|
|
|
+ // return resolve({enabled: [Notification], disabled: [Notification]})
|
|
|
};
|
|
|
|
|
|
// returns only enabled notification settings
|
|
|
notificationSchema.mothods.getEnabeldSettings = settings => {
|
|
|
- // return [Notification]
|
|
|
+ // return resolve([Notification])
|
|
|
};
|
|
|
|
|
|
// sort a list of notifications by path from short to long
|
|
|
notificationSchema.mothods.sortByPath = settings => {
|
|
|
- // return [Notification]
|
|
|
+ // return resolve([Notification])
|
|
|
};
|
|
|
|
|
|
return mongoose.model('GlobalNotificationSetting', notificationSchema);
|
|
|
};
|
|
|
-
|
|
|
-
|
|
|
-// const notifications = await findSettingByPathAndEvent(path, event);
|
|
|
-// notifications.forEach(notification => {
|
|
|
-// notification.send(); //??????????
|
|
|
-// });
|