Notification: Set a new Friendship and Accepted Friendship

This commit is contained in:
Paolo Arena
2022-07-26 15:46:39 +02:00
parent b06f1e4ab8
commit 3515914f17
15 changed files with 411 additions and 150 deletions

View File

@@ -339,9 +339,24 @@ router.post('/settable', authenticate, async (req, res) => {
});
}
let setnotif = false;
let typedir = 0;
let typeid = 0;
if (shared_consts.TABLES_ADV_NOTIFICATION.includes(params.table)) {
// E' un annuncio, pertanto mando una notifica a "tutti"
SendNotif.createNewNotification(req, res, params.table, myrec, shared_consts.TypeNotifs.TYPEDIR_BACHECA, shared_consts.TypeNotifs.ID_BACHECA_NEW_GOOD);
typedir = shared_consts.TypeNotifs.TYPEDIR_BACHECA;
typeid = (params.table === shared_consts.TABLES_MYGOODS) ? shared_consts.TypeNotifs.ID_BACHECA_NEW_GOOD : shared_consts.TypeNotifs.ID_BACHECA_NEW_SERVICE
setnotif = true;
}
if (shared_consts.TABLES_EVENTS_NOTIFICATION.includes(params.table)) {
typedir = shared_consts.TypeNotifs.TYPEDIR_EVENTS;
typeid = shared_consts.TypeNotifs.ID_EVENTS_NEW_REC;
setnotif = true;
}
if (setnotif) {
SendNotif.createNewNotification(req, res, params.table, myrec, typedir, typeid);
}
return res.send(myrec);