- Iscrizione Conacreis

- Ordini
- Carrello
This commit is contained in:
Paolo Arena
2021-04-30 01:31:12 +02:00
parent 0b4203067a
commit e05bbb39ee
41 changed files with 1495 additions and 337 deletions

83
src/server/models/site.js Executable file
View File

@@ -0,0 +1,83 @@
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 SiteSchema = new Schema({
active: {
type: Boolean,
},
idapp: {
type: String,
},
name: {
type: String,
},
adminemail: {
type: String,
},
manageremail: {
type: String,
},
replyTo: {
type: String,
},
host: {
type: String,
},
portapp: {
type: String,
},
dir: {
type: String,
},
email_from: {
type: String,
},
email_pwd: {
type: String,
},
telegram_key: {
type: String,
},
telegram_bot_name: {
type: String,
},
pathreg_add: {
type: String,
},
});
var Site = module.exports = mongoose.model('Site', SiteSchema);
module.exports.getFieldsForSearch = function () {
return []
};
module.exports.executeQueryTable = async function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch();
// return tools.executeQueryTable(this, null, params);
const myarr = await Site.find({});
return ({ count: myarr.length, rows: myarr })
};
module.exports.findAllIdApp = async function (idapp) {
const myfind = { active: true };
return await Site.find(myfind, (err, arrrec) => {
return arrrec
});
};