|
|
@@ -5,12 +5,13 @@ const Notification = this;
|
|
|
/*
|
|
|
* define schema
|
|
|
*/
|
|
|
-const notificationSchema = new mongoose.Schema({
|
|
|
- isEnabled: { type: Boolean, required: true, default: true },
|
|
|
- triggerPath: { type: String, required: true },
|
|
|
- triggerEvents: { type: [String] },
|
|
|
- notifyTo: { type: String, default: '{}',
|
|
|
- get: data => {
|
|
|
+
|
|
|
+const notifyToSchema = new mongoose.Schema({
|
|
|
+ type: { type: String, required: true },
|
|
|
+ extended: {
|
|
|
+ type: String,
|
|
|
+ default: '{}',
|
|
|
+ get: function(data) {
|
|
|
try {
|
|
|
return JSON.parse(data);
|
|
|
}
|
|
|
@@ -18,10 +19,19 @@ const notificationSchema = new mongoose.Schema({
|
|
|
return data;
|
|
|
}
|
|
|
},
|
|
|
- set: data => JSON.stringify(data)
|
|
|
+ set: function(data) {
|
|
|
+ return JSON.stringify(data);
|
|
|
+ }
|
|
|
},
|
|
|
});
|
|
|
|
|
|
+const notificationSchema = new mongoose.Schema({
|
|
|
+ isEnabled: { type: Boolean, required: true, default: true },
|
|
|
+ triggerPath: { type: String, required: true },
|
|
|
+ triggerEvents: { type: [String] },
|
|
|
+ notifyTo: notifyToSchema
|
|
|
+});
|
|
|
+
|
|
|
/**
|
|
|
* GlobalNotificationSetting Class
|
|
|
* @class GlobalNotificationSetting
|