- 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,66 @@
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 TemplEmailSchema = new Schema({
idapp: {
type: String,
},
subject: {
type: String,
},
testoheadermail: {
type: String,
},
content: {
type: String,
},
img: {
type: String,
},
content2: {
type: String,
},
img2: {
type: String,
},
options: [{
type: String,
}]
});
TemplEmailSchema.statics.getFieldsForSearch = function () {
return ['']
};
TemplEmailSchema.statics.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch();
return tools.executeQueryTable(this, idapp, params);
};
TemplEmailSchema.statics.findAllIdApp = async function (idapp) {
const TemplEmail = this;
const myfind = { idapp };
return await TemplEmail.find(myfind, (err, arrrec) => {
return arrrec
});
};
const TemplEmail = mongoose.model('TemplEmail', TemplEmailSchema);
module.exports = { TemplEmail };