Notifiche all'Utente

Pannello Utente (backoffice)
This commit is contained in:
Paolo Arena
2022-07-16 14:20:39 +02:00
parent 4486a09255
commit cbd65ccdbe
2 changed files with 32 additions and 0 deletions

View File

@@ -357,6 +357,11 @@ const UserSchema = new mongoose.Schema({
groupname: {type: String},
date: {type: Date},
}], // username
notifs: {
type: Number,
default: 1,
},
},
})
;

View File

@@ -433,6 +433,33 @@ router.post('/panel', authenticate, async (req, res) => {
});
router.post('/notifs', authenticate, async (req, res) => {
const notifs = req.body['notifs'];
idapp = req.body.idapp;
locale = req.body.locale;
const myuser = req.user;
if (!myuser) {
return res.status(404).
send({code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: ''});
}
try {
if (!!myuser) {
if (notifs) {
myuser.profile.notifs = notifs;
myuser.save();
}
}
} catch (e) {
tools.mylogserr('Error profile: ', e);
res.status(400).send();
}
});
router.post('/login', (req, res) => {
var body = _.pick(req.body,
['username', 'password', 'idapp', 'keyappid', 'lang']);