Fix(crud) destroyScope sends 404 when not found
This commit is contained in:
		@@ -309,6 +309,8 @@ export const destroyScope = ({ server, model, prefix = '/', config }) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      const list = await model.scope(request.params.scope).findAll({ include, where });
 | 
					      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()));
 | 
					      await Promise.all(list.map(instance => instance.destroy()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const listAsJSON = list.map((item) => item.toJSON());
 | 
					      const listAsJSON = list.map((item) => item.toJSON());
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user