diff --git a/package.json b/package.json index 5035b83..a6ce524 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hapi-sequelize-crud", - "version": "1.5.0", + "version": "1.5.1", "description": "Hapi plugin that automatically generates RESTful API for CRUD", "main": "build/index.js", "config": { diff --git a/src/associations/one-to-one.js b/src/associations/one-to-one.js index 130ed56..1ccd8fc 100644 --- a/src/associations/one-to-one.js +++ b/src/associations/one-to-one.js @@ -24,7 +24,11 @@ export const get = (server, a, b) => { if (request.query.include) include = [request.models[request.query.include]]; - let instance = await b.findOne({ + let where = _.omit(request.query, 'include'); + + let [instance] = await b.findAll({ + where, + include: include.concat({ model: a, where: {