- Abilita a Tutti la Newsletter news_on - isCommerciale - JobsInProgress - PCB: Corretto Totali che era a zero
85 lines
1.5 KiB
JavaScript
Executable File
85 lines
1.5 KiB
JavaScript
Executable File
const mongoose = require('mongoose').set('debug', false)
|
|
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,
|
|
},
|
|
disclaimer: {
|
|
type: String,
|
|
},
|
|
piedipagina: {
|
|
type: String,
|
|
},
|
|
firma: {
|
|
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.DuplicateAllRecords = async function (idapporig, idappdest) {
|
|
|
|
return await tools.DuplicateAllRecords(this, idapporig, idappdest);
|
|
|
|
};
|
|
|
|
|
|
TemplEmailSchema.statics.findAllIdApp = async function (idapp) {
|
|
const TemplEmail = this;
|
|
|
|
const myfind = { idapp };
|
|
|
|
return await TemplEmail.find(myfind).lean();
|
|
};
|
|
|
|
|
|
const TemplEmail = mongoose.model('TemplEmail', TemplEmailSchema);
|
|
|
|
TemplEmail.createIndexes()
|
|
.then(() => { })
|
|
.catch((err) => { throw err; });
|
|
|
|
|
|
module.exports = { TemplEmail };
|