Aggiunte opzioni per il Gestore: richiede che l'invitante confermi la Reg, Notifica sul BOT , Notifica all'Admin la Reg.

This commit is contained in:
paoloar77
2022-02-27 16:56:02 +01:00
parent 2749506de7
commit 8d98726f1f
9 changed files with 175 additions and 85 deletions

View File

@@ -71,9 +71,6 @@ const SiteSchema = new Schema({
pathreg_add: {
type: String,
},
ask_to_verify_reg: {
type: Boolean,
},
who: {
type: String
},
@@ -92,6 +89,12 @@ const SiteSchema = new Schema({
next_payment: {
type: Date
},
confsite: {
options: { // ConfSite
type: Number,
default: 0,
},
}
});
var Site = module.exports = mongoose.model('Site', SiteSchema);
@@ -100,13 +103,26 @@ module.exports.getFieldsForSearch = function () {
return []
};
module.exports.executeQueryTable = async function (idapp, params) {
module.exports.executeQueryTable = async function (idapp, params, userreq) {
params.fieldsearch = this.getFieldsForSearch();
// return tools.executeQueryTable(this, null, params);
const myarr = await Site.find({});
const { User } = require('../models/user');
return ({ count: myarr.length, rows: myarr })
// Solo l'Admin puó leggerlo
const extrapar = params.extrapar;
if (extrapar) {
return await Site.findOne({idapp: extrapar}, {name: 1, manageremail: 1, confsite: 1}).lean();
}
if (User.isAdmin(userreq.perm)) {
const myarr = await Site.find({});
return ({ count: myarr.length, rows: myarr })
}
};
@@ -115,6 +131,6 @@ module.exports.findAllIdApp = async function (idapp) {
const myfind = { active: true };
return Site.find(myfind);
return Site.find(myfind).lean();
};