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