diff --git a/src/crud.js b/src/crud.js index be9bcd1..32cc61a 100644 --- a/src/crud.js +++ b/src/crud.js @@ -309,6 +309,8 @@ export const destroyScope = ({ server, model, prefix = '/', config }) => { const list = await model.scope(request.params.scope).findAll({ include, where }); + if (!list.length) return void reply(notFound('Nothing found.')); + await Promise.all(list.map(instance => instance.destroy())); const listAsJSON = list.map((item) => item.toJSON());