Abilitazione del BOT
This commit is contained in:
@@ -50,11 +50,11 @@ const BotSchema = new Schema({
|
||||
},
|
||||
});
|
||||
|
||||
BotSchema.statics.getFieldsForSearch = function() {
|
||||
BotSchema.statics.getFieldsForSearch = function () {
|
||||
return [{ field: 'label', type: tools.FieldType.string }]
|
||||
};
|
||||
|
||||
BotSchema.statics.executeQueryTable = function(idapp, params) {
|
||||
BotSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
params.fieldsearch = this.getFieldsForSearch();
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
@@ -66,12 +66,141 @@ BotSchema.statics.DuplicateAllRecords = async function (idapporig, idappdest) {
|
||||
};
|
||||
|
||||
|
||||
BotSchema.statics.findAllIdApp = async function(idapp) {
|
||||
BotSchema.statics.generateBotMenuRecords = async function (idapp) {
|
||||
|
||||
try {
|
||||
let arrrec = [
|
||||
{
|
||||
"page": 1,
|
||||
"index": 1,
|
||||
"riga": 1,
|
||||
"active": true,
|
||||
"label": "Vai al Sito",
|
||||
"type": 3,
|
||||
"value": "{host}",
|
||||
"visibility": 0,
|
||||
idapp,
|
||||
"lang": "it",
|
||||
"main": true
|
||||
},
|
||||
{
|
||||
"page": 1,
|
||||
"index": 1,
|
||||
"riga": 2,
|
||||
"active": true,
|
||||
"label": "Il mio Profilo",
|
||||
"type": 3,
|
||||
"value": "{host}/my/{username}",
|
||||
"visibility": 1,
|
||||
idapp,
|
||||
"lang": "it",
|
||||
"main": true
|
||||
},
|
||||
{
|
||||
"page": 1,
|
||||
"index": 1,
|
||||
"riga": 3,
|
||||
"active": true,
|
||||
"label": "Link da Condividere",
|
||||
"type": 2,
|
||||
"value": "{host}/registrati/{username}",
|
||||
"visibility": 1,
|
||||
idapp,
|
||||
"lang": "it",
|
||||
"main": true,
|
||||
},
|
||||
{
|
||||
"page": 1,
|
||||
"index": 2,
|
||||
"riga": 1,
|
||||
"active": true,
|
||||
"label": "🔮 Help",
|
||||
"type": 4,
|
||||
"value": "",
|
||||
"visibility": 0,
|
||||
idapp,
|
||||
"lang": "it",
|
||||
"main": true,
|
||||
},
|
||||
{
|
||||
"page": 1,
|
||||
"index": 1,
|
||||
"riga": 3,
|
||||
"active": true,
|
||||
"label": "💁♀️ Admin",
|
||||
"type": 4,
|
||||
"value": "",
|
||||
"visibility": 5,
|
||||
idapp,
|
||||
"lang": "it",
|
||||
"main": true
|
||||
},
|
||||
{
|
||||
"page": 1,
|
||||
"index": 2,
|
||||
"riga": 2,
|
||||
"active": true,
|
||||
"label": "Imposta Foto Profilo",
|
||||
"type": 4,
|
||||
"value": "🖼 SetPicProfile",
|
||||
"visibility": 1,
|
||||
idapp,
|
||||
"lang": "it",
|
||||
"main": true
|
||||
},
|
||||
{
|
||||
"page": 1,
|
||||
"index": 2,
|
||||
"riga": 3,
|
||||
"active": true,
|
||||
"label": "🛠 Strumenti",
|
||||
"type": 1,
|
||||
"value": "2",
|
||||
"visibility": 1,
|
||||
idapp,
|
||||
"lang": "it",
|
||||
"main": true,
|
||||
},
|
||||
{
|
||||
"page": 2,
|
||||
"index": 1,
|
||||
"riga": 1,
|
||||
"active": true,
|
||||
"label": "🔑 Cambio Password",
|
||||
"type": 4,
|
||||
"value": "🔑 SetResetPwd",
|
||||
"visibility": 1,
|
||||
idapp,
|
||||
"lang": "it",
|
||||
},
|
||||
{
|
||||
"page": 2,
|
||||
"index": 1,
|
||||
"riga": 2,
|
||||
"active": true,
|
||||
"label": "👉🏻 Indietro",
|
||||
"type": 1,
|
||||
"value": "1",
|
||||
"visibility": 1,
|
||||
idapp,
|
||||
"lang": "it",
|
||||
}];
|
||||
|
||||
const ris = await MyBot.insertMany(arrrec);
|
||||
|
||||
return ris;
|
||||
|
||||
} catch (e) {
|
||||
console.error('Err:', e);
|
||||
}
|
||||
|
||||
}
|
||||
BotSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Bot = this;
|
||||
|
||||
const myfind = {idapp};
|
||||
const myfind = { idapp };
|
||||
|
||||
return await Bot.find(myfind).sort({page: 1, lang: 1, riga: 1, index: 1}).lean();
|
||||
return await Bot.find(myfind).sort({ page: 1, lang: 1, riga: 1, index: 1 }).lean();
|
||||
};
|
||||
|
||||
const MyBot = mongoose.model('Bot', BotSchema);
|
||||
@@ -80,4 +209,4 @@ MyBot.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
|
||||
module.exports = {MyBot};
|
||||
module.exports = { MyBot };
|
||||
|
||||
Reference in New Issue
Block a user