mirror of
https://github.com/usatiuk/ustk-todolist.git
synced 2025-10-28 23:57:49 +01:00
create, update, remove users
This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user