Notifiche - Tutti - non letti

This commit is contained in:
Paolo Arena
2022-07-21 00:21:03 +02:00
parent cbd65ccdbe
commit e9ce597027
10 changed files with 235 additions and 177 deletions

View File

@@ -14,7 +14,7 @@ const sendemail = require('../sendemail');
const _ = require('lodash');
const sendNotif = async (res, idapp, user, recbooking) => {
const sendNotifBooking = async (res, idapp, user, recbooking) => {
//++Todo: tools.sendNotificationToUser
// Send Email
@@ -50,7 +50,7 @@ router.post('/', authenticate, (req, res) => {
}).then((recbooking) => {
// tools.mylog('booking:', booking);
// tools.mylog('already exist');
sendNotif(res, myrec.idapp, req.user, myrec);
sendNotifBooking(res, myrec.idapp, req.user, myrec);
return res.send({ code: server_constants.RIS_CODE_OK, msg: '', id });
});
} else {
@@ -62,7 +62,7 @@ router.post('/', authenticate, (req, res) => {
Booking.findById(idobj)
.then((recbooking) => {
sendNotif(res, myrec.idapp, req.user, writeresult);
sendNotifBooking(res, myrec.idapp, req.user, writeresult);
return res.send({ code: server_constants.RIS_CODE_OK, msg: '', id: writeresult._id });
});
});
@@ -86,7 +86,7 @@ router.delete('/:id/:notify/:idapp', authenticate, (req, res) => {
if (notify === '1') {
recbooking.booked = false;
sendNotif(res, idapp, req.user, recbooking);
sendNotifBooking(res, idapp, req.user, recbooking);
}
tools.mylog('DELETED ', recbooking._id);