- fix: La partecipazione agli eventi, non viene salvata correttamente e non visualizzava.

This commit is contained in:
Surya Paolo
2024-09-30 14:50:19 +02:00
parent 0973fc8757
commit 0a9e012de0
6 changed files with 58 additions and 14 deletions

View File

@@ -45,7 +45,7 @@ router.post('/', authenticate, (req, res) => {
// console.log('trovato', trovato);
if (trovato) {
return Booking.findOneAndUpdate({ id_bookedevent: id }, { $set: fieldtochange }, {
new: false,
new: true,
upsert: true
}).then((recbooking) => {
// tools.mylog('booking:', booking);
@@ -79,7 +79,7 @@ router.delete('/:id/:notify/:idapp', authenticate, (req, res) => {
const notify = req.params.notify;
const idapp = req.params.idapp;
Booking.deleteOne({_id: id}).then((recbooking) => {
Booking.findOneAndDelete({_id: id}).then((recbooking) => {
if (!recbooking) {
return res.status(404).send();
}

View File

@@ -1409,7 +1409,13 @@ router.get('/loadsite/:userId/:idapp/:vers', authenticate_noerror,
function load(req, res, version) {
const userId = req.params.userId;
let userId = '0';
try {
userId = req.user ? req.user._id.toString() : req.params.userId;
} catch (e) {
console.error('Err userId LOAD', e);
userId = '0';
}
const idapp = req.params.idapp;
let status = 200

View File

@@ -1432,6 +1432,8 @@ async function eseguiDbOp(idapp, mydata, locale, req, res) {
await SendNotif.RemovePendentTransactions(true);
} else if (mydata.dbop === 'RemoveOldNotif90') {
await SendNotif.RemoveOldNotif90(idapp);
} else if (mydata.dbop === 'RemoveOldNotif30') {
await SendNotif.RemoveOldNotif30(idapp);
} else if (mydata.dbop === 'UpdateCoordProv') {
await Province.setCoordinatesOnDB();
} else if (mydata.dbop === 'insertGeojsonToMongoDB') {