- Aggiunto Filtri
- Finder
This commit is contained in:
@@ -1106,9 +1106,7 @@ module.exports = {
|
||||
return (myapp) ? myapp.telegram_key : '';
|
||||
},
|
||||
|
||||
getQueryTable(idapp, params) {
|
||||
// console.log('idapp', idapp);
|
||||
// console.table(params);
|
||||
getQueryTable: function(idapp, params) {
|
||||
|
||||
if (typeof params.startRow !== 'number') {
|
||||
throw new Error('startRow must be number');
|
||||
@@ -1257,6 +1255,14 @@ module.exports = {
|
||||
|
||||
}
|
||||
|
||||
if (params.filtercustom) {
|
||||
filtriadded.push(...params.filtercustom);
|
||||
}
|
||||
|
||||
if (params.filtersearch) {
|
||||
filtriadded.push(...params.filtersearch);
|
||||
}
|
||||
|
||||
if (filtriadded.length > 0)
|
||||
query.push({$match: {$and: filtriadded}});
|
||||
|
||||
@@ -1340,14 +1346,18 @@ module.exports = {
|
||||
async executeQueryTable(mythistable, idapp, params) {
|
||||
let query = this.getQueryTable(idapp, params);
|
||||
|
||||
const [ris] = await mythistable.aggregate(query);
|
||||
try {
|
||||
const [ris] = await mythistable.aggregate(query);
|
||||
|
||||
if (ris) {
|
||||
// console.table(ris.rows);
|
||||
// console.log('ROW ', ris.count);
|
||||
return ({count: ris.count, rows: ris.rows});
|
||||
} else {
|
||||
return ({count: 0, rows: []});
|
||||
if (ris) {
|
||||
// console.table(ris.rows);
|
||||
// console.log('ROW ', ris.count);
|
||||
return ({count: ris.count, rows: ris.rows});
|
||||
} else {
|
||||
return ({count: 0, rows: []});
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('error', e);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user