Fix where parsing needs to be spread #18

Closed
joeybaker wants to merge 1 commits from fix-list-where into master

View File

@ -79,7 +79,7 @@ export const list = ({ server, model, prefix, config }) => {
if (include instanceof Error) return void reply(include); if (include instanceof Error) return void reply(include);
const list = await model.findAll({ const list = await model.findAll({
where, include, ...where, include,
}); });
reply(list); reply(list);
@ -101,7 +101,7 @@ export const get = ({ server, model, prefix, config }) => {
const { id } = request.params; const { id } = request.params;
if (id) where[model.primaryKeyField] = id; 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.`)); if (!instance) return void reply(notFound(`${id} not found.`));