- Import emails from a list to a DB

- Create Template Emails
- Options Email
This commit is contained in:
Paolo Arena
2019-12-04 02:03:44 +01:00
parent f7fa0c4909
commit 6adeb32d46
19 changed files with 1061 additions and 211 deletions

View File

@@ -0,0 +1,47 @@
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const tools = require('../tools/general');
mongoose.Promise = global.Promise;
mongoose.level = "F";
// Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => {
schema.options.usePushEach = true
});
const OpzEmailSchema = new Schema({
key: {
type: String,
default: ''
},
label_it: {
type: String,
}
});
OpzEmailSchema.statics.getFieldsForSearch = function () {
return ['label_it']
};
OpzEmailSchema.statics.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch();
return tools.executeQueryTable(this, 0, params);
};
OpzEmailSchema.statics.findAllIdApp = async function (idapp) {
const OpzEmail = this;
return await OpzEmail.find({}, (err, arrrec) => {
return arrrec
});
};
const OpzEmail = mongoose.model('OpzEmail', OpzEmailSchema);
module.exports = { OpzEmail };