Fix(crud) destroyScope sends 404 when not found
This commit is contained in:
parent
01081db7a3
commit
1daa68e03e
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user