++ Projects

This commit is contained in:
Paolo Arena
2019-03-28 12:58:58 +01:00
parent efceb9915b
commit f4ad69674e
5 changed files with 329 additions and 2 deletions

View File

@@ -81,11 +81,13 @@ router.patch('/:id', authenticate, (req, res) => {
Todo.findByIdAndUpdate(id, { $set: body }, { new: true }).then((todo) => {
tools.mylogshow(' TODO TO MODIFY: ', todo.descr, todo.expiring_at);
if (!todo) {
tools.mylogshow(' TODO NOT FOUND !: id:', id, 'body: ', body);
return res.status(404).send();
}
tools.mylogshow(' TODO TO MODIFY: ', todo.descr, todo.expiring_at);
if (todo.userId !== String(req.user._id)) {
// I'm trying to write something not mine!
return res.status(404).send({ code: server_constants.RIS_CODE_TODO_CREATING_NOTMYUSER });
@@ -107,7 +109,7 @@ router.get('/:userId', authenticate, (req, res) => {
var userId = req.params.userId;
// var category = req.params.category;
tools.mylog('GET : ', req.params);
tools.mylog('GET TODOS : ', req.params);
if (!ObjectID.isValid(userId)) {
return res.status(404).send();