disattivare l'abilitazione se la registrazione arriva da me paoloar77 Sistemato il Menu del BOT per inviare msg a tutti e per ricevere il proprio Link personale. Non permettere il cambio del codice del gruppo Aggiunta la Provincia tra parentesi nei Comuni: es Rimini (RN)
74 lines
1.4 KiB
JavaScript
Executable File
74 lines
1.4 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 BotSchema = new Schema({
|
|
idapp: {
|
|
type: String,
|
|
},
|
|
page: {
|
|
type: Number,
|
|
},
|
|
index: {
|
|
type: Number,
|
|
},
|
|
riga: {
|
|
type: Number,
|
|
},
|
|
active: {
|
|
type: Boolean,
|
|
},
|
|
lang: {
|
|
type: String,
|
|
},
|
|
main: {
|
|
type: Boolean,
|
|
},
|
|
label: {
|
|
type: String,
|
|
},
|
|
type: {
|
|
type: Number,
|
|
},
|
|
value: {
|
|
type: String,
|
|
},
|
|
visibility: {
|
|
type: Number, // VISIB_ALL, VISIB_ONLYIF_LOGGED, VISIB_ONLY_ADMIN
|
|
},
|
|
date_updated: {
|
|
type: Date,
|
|
default: Date.now,
|
|
},
|
|
});
|
|
|
|
BotSchema.statics.getFieldsForSearch = function() {
|
|
return [{ field: 'label', type: tools.FieldType.string }]
|
|
};
|
|
|
|
BotSchema.statics.executeQueryTable = function(idapp, params) {
|
|
params.fieldsearch = this.getFieldsForSearch();
|
|
return tools.executeQueryTable(this, idapp, params);
|
|
};
|
|
|
|
BotSchema.statics.findAllIdApp = async function(idapp) {
|
|
const Bot = this;
|
|
|
|
const myfind = {idapp};
|
|
|
|
return Bot.find(myfind).sort({page: 1, lang: 1, riga: 1, index: 1}).lean();
|
|
};
|
|
|
|
const MyBot = mongoose.model('Bot', BotSchema);
|
|
|
|
module.exports = {MyBot};
|