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:
@@ -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();
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user