- fix RIS in pendenti, se troppi msg, non compariva piu

- cataloghi, ricerca pickup
This commit is contained in:
Surya Paolo
2024-05-09 23:36:46 +02:00
parent 54443e784e
commit 3b1b2b9c83
13 changed files with 296 additions and 94 deletions

View File

@@ -73,6 +73,7 @@ const CatAI = require('../models/catai');
const SubCatProd = require('../models/subcatprod');
const Gasordine = require('../models/gasordine');
const Product = require('../models/product');
const Author = require('../models/author');
const ProductInfo = require('../models/productInfo');
const Scontistica = require('../models/scontistica');
const Department = require('../models/department');
@@ -1488,6 +1489,7 @@ function load(req, res, version) {
} catch (e) {
}
let products = Product.findAllIdApp(idapp, undefined, undefined, ismanager);
let authors = Author.findAllIdApp(idapp);
let productInfos = ProductInfo.findAllIdApp(idapp);
let scontisticas = Scontistica.findAllIdApp(idapp);
let departments = Department.findAllIdApp(idapp);
@@ -1584,6 +1586,7 @@ function load(req, res, version) {
subcatprods,
catprods_gas,
catAI,
authors,
]).then((arrdata) => {
// console.table(arrdata);
let myuser = req.user;
@@ -1676,6 +1679,7 @@ function load(req, res, version) {
catprods_gas: arrdata[47],
catAI: arrdata[48],
code: req.code,
authors: arrdata[49],
});
const prova = 1;
@@ -1696,7 +1700,7 @@ router.get(process.env.LINK_CHECK_UPDATES, authenticate_noerror, async (req, res
return res.status(200).send();
}
await CfgServer.find({ idapp }).then((arrcfgrec) => {
await CfgServer.find({ idapp }).then(async (arrcfgrec) => {
if (!arrcfgrec)
return res.status(404).send();
@@ -1705,6 +1709,7 @@ router.get(process.env.LINK_CHECK_UPDATES, authenticate_noerror, async (req, res
let last_msgs = null;
let last_notifs = null;
let last_notifcoins = null;
let usersList = null;
// const sall = '0';
@@ -1718,6 +1723,8 @@ router.get(process.env.LINK_CHECK_UPDATES, authenticate_noerror, async (req, res
last_msgs = SendMsg.findLastGroupByUserIdAndIdApp(userId, req.user.username, idapp);
last_notifs = SendNotif.findLastNotifsByUserIdAndIdApp(req.user.username, idapp, 40);
last_notifcoins_inattesa = SendNotif.findLastNotifCoinsByUserIdAndIdApp(req.user.username, idapp, 200, true);
last_notifcoins = SendNotif.findLastNotifCoinsByUserIdAndIdApp(req.user.username, idapp, 1, false);
if (req.user) {
// If User is Admin, then send user Lists
@@ -1731,13 +1738,14 @@ router.get(process.env.LINK_CHECK_UPDATES, authenticate_noerror, async (req, res
}
}
return Promise.all([usersList, last_msgs, last_notifs]).then((arrdata) => {
return Promise.all([usersList, last_msgs, last_notifs, last_notifcoins, last_notifcoins_inattesa]).then((arrdata) => {
// console.table(arrdata);
return res.send({
CfgServer: arrcfgrec,
usersList: arrdata[0],
last_msgs: arrdata[1],
last_notifs: arrdata[2],
last_notifcoins: [...arrdata[4], ...arrdata[3]],
});
});