mirror of
https://github.com/usatiuk/ustk-todolist.git
synced 2025-10-29 08:07:48 +01:00
add removeWithTodos to TodoList model
This commit is contained in:
@@ -31,6 +31,7 @@ router.post(
|
||||
}),
|
||||
);
|
||||
|
||||
// delete
|
||||
router.delete(
|
||||
'/:slug',
|
||||
asyncHelper(async (req, res) => {
|
||||
@@ -41,10 +42,7 @@ router.delete(
|
||||
if (!list) {
|
||||
throw new NotFoundError();
|
||||
}
|
||||
list.todos.forEach((todo) => {
|
||||
todo.remove();
|
||||
});
|
||||
list.remove();
|
||||
await list.removeWithTodos();
|
||||
res.json({ success: true });
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user