Fix where parsing needs to be spread

Otherwise we get a sequelize options object that looks like

```js
{
  where: {
    where: {}
  }
}
```
This commit is contained in:
Joey Baker 2016-09-02 15:16:46 -07:00
parent 79c6a81a3a
commit 46d2605830

View File

@ -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.`));