Notifiche all'Utente
Pannello Utente (backoffice)
This commit is contained in:
@@ -357,6 +357,11 @@ const UserSchema = new mongoose.Schema({
|
|||||||
groupname: {type: String},
|
groupname: {type: String},
|
||||||
date: {type: Date},
|
date: {type: Date},
|
||||||
}], // username
|
}], // username
|
||||||
|
|
||||||
|
notifs: {
|
||||||
|
type: Number,
|
||||||
|
default: 1,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -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) => {
|
router.post('/login', (req, res) => {
|
||||||
var body = _.pick(req.body,
|
var body = _.pick(req.body,
|
||||||
['username', 'password', 'idapp', 'keyappid', 'lang']);
|
['username', 'password', 'idapp', 'keyappid', 'lang']);
|
||||||
|
|||||||
Reference in New Issue
Block a user