- Import emails from a list to a DB
- Create Template Emails - Options Email
This commit is contained in:
66
src/server/models/templemail.js
Normal file
66
src/server/models/templemail.js
Normal 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 };
|
||||
Reference in New Issue
Block a user