- Migliorata la Notifica degli Eventi su Telegram
- Gli annunci (beni/servizi/ospitalità) ora possono essere visti anche tramite un link, anche per chi non è dentro alla App. - Aggiunto bottone "Aggiorna" per aggiornare il Saldo attuale. - I "Conti Collettivi" ora vengono chiamati Gruppi (o Conto di Gruppo).
This commit is contained in:
@@ -5,6 +5,8 @@ const tools = require('../tools/general');
|
||||
|
||||
const server_constants = require('../tools/server_constants');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const { authenticate } = require('../middleware/authenticate');
|
||||
|
||||
const mongoose = require('mongoose').set('debug', false);
|
||||
@@ -82,7 +84,8 @@ router.post('/load', authenticate, async (req, res) => {
|
||||
data.account = await Account.getAccountByUsernameAndCircuitId(idapp, '', data._id, false, false, '', data.path);
|
||||
}
|
||||
|
||||
const arrrecnotif = await SendNotif.findAllNotifByUsernameIdAndIdApp(req.user.username, lastdr, idapp);
|
||||
const arrrecnotif = await SendNotif.findAllNotifByUsernameIdAndIdApp(req.user.username, lastdr, idapp, shared_consts.LIMIT_NOTIF_FOR_USER);
|
||||
/// E' QUIIII !!!!
|
||||
const useraccounts = await Account.getUserAccounts(idapp, req.user.username);
|
||||
|
||||
await User.setLastCircuitOpened(idapp, req.user.username, path);
|
||||
|
||||
@@ -428,6 +428,7 @@ router.post('/settable', authenticate, async (req, res) => {
|
||||
|
||||
return await myPromise
|
||||
.then(async (doupdate) => {
|
||||
|
||||
if (doupdate)
|
||||
return mytable.updateOne({ _id: mytablerec._id }, mydata, { new: true })
|
||||
else
|
||||
|
||||
@@ -8,35 +8,39 @@ const tools = require('../tools/general');
|
||||
|
||||
var server_constants = require('../tools/server_constants');
|
||||
|
||||
var {authenticate, auth_default} = require('../middleware/authenticate');
|
||||
var { authenticate, authenticate_noerror, auth_default } = require('../middleware/authenticate');
|
||||
|
||||
var mongoose = require('mongoose').set('debug', false);
|
||||
const Subscription = mongoose.model('subscribers');
|
||||
|
||||
const _ = require('lodash');
|
||||
const {MyBacheca} = require('../models/mybacheca');
|
||||
var {User} = require('../models/user');
|
||||
const { MyBacheca } = require('../models/mybacheca');
|
||||
var { User } = require('../models/user');
|
||||
const { Reaction } = require('../models/reaction');
|
||||
|
||||
const globalTables = require('../tools/globalTables');
|
||||
|
||||
const {ObjectID} = require('mongodb');
|
||||
const { ObjectID } = require('mongodb');
|
||||
|
||||
//GET orders
|
||||
router.post('/page', authenticate, function(req, res, next) {
|
||||
router.post('/page', authenticate_noerror, function (req, res, next) {
|
||||
|
||||
const {SendNotif} = require('../models/sendnotif');
|
||||
const { SendNotif } = require('../models/sendnotif');
|
||||
|
||||
try {
|
||||
let table = req.body.table;
|
||||
let id = req.body.id;
|
||||
let idapp = req.body.idapp;
|
||||
|
||||
const username = req.user.username ? req.user.username : '';
|
||||
let username = ''
|
||||
if (req.user)
|
||||
username = req.user.username ? req.user.username : '';
|
||||
|
||||
// Check if ìs a Notif to read
|
||||
const idnotif = req.body.idnotif ? req.body.idnotif : '';
|
||||
SendNotif.setNotifAsRead(idapp, username, idnotif);
|
||||
if (username) {
|
||||
// Check if ìs a Notif to read
|
||||
const idnotif = req.body.idnotif ? req.body.idnotif : '';
|
||||
SendNotif.setNotifAsRead(idapp, username, idnotif);
|
||||
}
|
||||
|
||||
let mytable = null;
|
||||
if (shared_consts.TABLES_ENABLE_GETREC_BYID.includes(table)) {
|
||||
@@ -47,29 +51,30 @@ router.post('/page', authenticate, function(req, res, next) {
|
||||
if (mytable) {
|
||||
|
||||
return mytable.getMyRecById(idapp, id).
|
||||
then(async (ris) => {
|
||||
then(async (ris) => {
|
||||
|
||||
// Se è un record singolo di tipo Reaction,
|
||||
// allora gli devo passare anche le liste degli utenti :
|
||||
/*if (globalTables.isTableReaction(table)) {
|
||||
// ...
|
||||
const myreaction = await Reaction.find({idapp, idrec: id}).lean();
|
||||
ris.myreaction = myreaction;
|
||||
};*/
|
||||
// Se è un record singolo di tipo Reaction,
|
||||
// allora gli devo passare anche le liste degli utenti :
|
||||
if (globalTables.isTableReaction(table)) {
|
||||
// ...
|
||||
// const myreaction = await Reaction.find({idapp, idrec: id}).lean();
|
||||
// ris.myreaction = myreaction;
|
||||
|
||||
if (ris) {
|
||||
res.send(ris);
|
||||
};
|
||||
|
||||
} else {
|
||||
res.status(400).send();
|
||||
}
|
||||
}).catch((e) => {
|
||||
console.error('Err', e);
|
||||
res.status(400).send(e);
|
||||
})
|
||||
if (ris) {
|
||||
res.send(ris);
|
||||
|
||||
} else {
|
||||
res.status(400).send();
|
||||
}
|
||||
}).catch((e) => {
|
||||
console.error('Err', e);
|
||||
res.status(400).send(e);
|
||||
})
|
||||
|
||||
}
|
||||
}catch (e) {
|
||||
} catch (e) {
|
||||
console.error('/page', e);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@ const _ = require('lodash');
|
||||
|
||||
const reg = require('../reg/registration');
|
||||
|
||||
const { authenticate } = require('../middleware/authenticate');
|
||||
const { authenticate, authenticate_noerror } = require('../middleware/authenticate');
|
||||
|
||||
const TypedError = require('../modules/ErrorHandler');
|
||||
|
||||
const mongoose = require('mongoose').set('debug', false);
|
||||
|
||||
router.post('/cmd', authenticate, async (req, res) => {
|
||||
router.post('/cmd', authenticate_noerror, async (req, res) => {
|
||||
|
||||
const mydata = req.body.mydata;
|
||||
const idapp = req.body.idapp;
|
||||
@@ -43,7 +43,12 @@ router.post('/cmd', authenticate, async (req, res) => {
|
||||
|
||||
|
||||
try {
|
||||
const username = req.user.username;
|
||||
let username = '';
|
||||
if (req.user) {
|
||||
username = req.user.username;
|
||||
} else {
|
||||
return res.send({ state: 0, record: null });
|
||||
}
|
||||
|
||||
let ris = null;
|
||||
let record = null;
|
||||
|
||||
@@ -144,7 +144,7 @@ router.get('/:username/:lastdataread/:idapp', authenticate, (req, res) => {
|
||||
return res.status(404).send({code: server_constants.RIS_CODE_NOT_MY_USERNAME});
|
||||
}
|
||||
|
||||
return SendNotif.findAllNotifByUsernameIdAndIdApp(username, lastdataread, idapp).then(async (arrnotif) => {
|
||||
return SendNotif.findAllNotifByUsernameIdAndIdApp(username, lastdataread, idapp, shared_consts.LIMIT_NOTIF_FOR_USER).then(async (arrnotif) => {
|
||||
// const wait = new Promise((resolve, reject) => {
|
||||
// setTimeout(() => {
|
||||
|
||||
|
||||
@@ -705,6 +705,26 @@ router.post('/circuits', authenticate, (req, res) => {
|
||||
|
||||
});
|
||||
|
||||
router.post('/updatesaldo', authenticate, async (req, res) => {
|
||||
const username = req.user.username;
|
||||
idapp = req.body.idapp;
|
||||
locale = req.body.locale;
|
||||
|
||||
try {
|
||||
const userprofile = await User.getExtraInfoByUsername(idapp, username);
|
||||
let ris = {
|
||||
userprofile
|
||||
}
|
||||
|
||||
return res.send({ris});
|
||||
|
||||
} catch (e) {
|
||||
tools.mylog('ERRORE IN updatesaldo: ' + e);
|
||||
res.status(400).send();
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
router.post('/friends/cmd', authenticate, async (req, res) => {
|
||||
const usernameLogged = req.user.username;
|
||||
const idapp = req.body.idapp;
|
||||
@@ -1166,6 +1186,10 @@ async function eseguiDbOp(idapp, mydata, locale, req, res) {
|
||||
console.log('e', e);
|
||||
}
|
||||
|
||||
} else if (mydata.dbop === 'removeRecordsFav') {
|
||||
// Passa le tabelle da users sulle nuove tabelle:
|
||||
await User.removerecordsFavorite();
|
||||
|
||||
} else if (mydata.dbop === 'newRecordsFav') {
|
||||
// Passa le tabelle da users sulle nuove tabelle:
|
||||
await User.moverecordsFavorite(1);
|
||||
|
||||
Reference in New Issue
Block a user