Fix: include option api correction

AFAIK, hapi-sequelize doesn't have a `request.models`, but it does have
a `request.getDb()` method that has `models` on it. This calls that
method to get the related models, but allows `request.models` to keep
working for backward compatibility.
This commit is contained in:
Joey Baker
2016-07-05 18:33:03 -07:00
parent 07af23cb5a
commit 2ea6c2e3a8
2 changed files with 15 additions and 4 deletions

View File

@ -31,6 +31,8 @@ export const list = (server, model) => {
const include = parseInclude(request);
const where = parseWhere(request);
if (include instanceof Error) return void reply(include);
const list = await model.findAll({
where, include,
});