From 46d2605830f9c27c910343997255930c18fe1780 Mon Sep 17 00:00:00 2001 From: Joey Baker Date: Fri, 2 Sep 2016 15:16:46 -0700 Subject: [PATCH] Fix where parsing needs to be spread Otherwise we get a sequelize options object that looks like ```js { where: { where: {} } } ``` --- src/crud.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crud.js b/src/crud.js index 87fea03..5244ef6 100644 --- a/src/crud.js +++ b/src/crud.js @@ -79,7 +79,7 @@ export const list = ({ server, model, prefix, config }) => { if (include instanceof Error) return void reply(include); const list = await model.findAll({ - where, include, + ...where, include, }); reply(list); @@ -101,7 +101,7 @@ export const get = ({ server, model, prefix, config }) => { const { id } = request.params; if (id) where[model.primaryKeyField] = id; - const instance = await model.findOne({ where, include }); + const instance = await model.findOne({ ...where, include }); if (!instance) return void reply(notFound(`${id} not found.`)); -- 2.34.1