create, update, remove users

This commit is contained in:
2018-05-30 19:24:48 +03:00
parent 00f71bb78d
commit fd142c8710
11 changed files with 1853 additions and 1413 deletions

View File

@@ -43,11 +43,7 @@ router.patch(
if (completed !== undefined) {
patch.completed = completed;
}
const todo = await Todo.findByIdAndUpdate(
{ _id: todoId },
{ $set: patch },
{ new: true },
).exec();
const todo = await Todo.findByIdAndUpdate(todoId, { $set: patch }, { new: true }).exec();
if (!todo) {
throw new NotFoundError(`can't find todo with id ${todoId}`);
}