From aebff50d0b207f2f68743f1119bf2c36d844379a Mon Sep 17 00:00:00 2001 From: Mahdi Dibaiee Date: Sun, 24 Jan 2016 15:07:31 +0330 Subject: [PATCH] fix(one-to-one): should not require an id for the second model, because there is only one anyways --- package.json | 2 +- src/associations/associate.js | 1 - src/associations/one-to-one.js | 6 +----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 1e52d78..83585e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hapi-sequelize-crud", - "version": "1.3.0", + "version": "1.3.1", "description": "Hapi plugin that automatically generates RESTful API for CRUD", "main": "build/index.js", "config": { diff --git a/src/associations/associate.js b/src/associations/associate.js index 5c6772e..ad48069 100644 --- a/src/associations/associate.js +++ b/src/associations/associate.js @@ -7,7 +7,6 @@ let prefix; export default (server, a, b, options) => { prefix = options.prefix; - console.log(`${prefix}/associate/${a._singular}/{aid}/${b._singular}/{bid}`); server.route({ method: 'GET', path: `${prefix}/associate/${a._singular}/{aid}/${b._singular}/{bid}`, diff --git a/src/associations/one-to-one.js b/src/associations/one-to-one.js index dcd3723..a93b2a9 100644 --- a/src/associations/one-to-one.js +++ b/src/associations/one-to-one.js @@ -15,15 +15,11 @@ export default (server, a, b, options) => { export const get = (server, a, b) => { server.route({ method: 'GET', - path: `${prefix}/${a._singular}/{aid}/${b._singular}/{bid}`, + path: `${prefix}/${a._singular}/{aid}/${b._singular}`, @error async handler(request, reply) { let instance = await b.findOne({ - where: { - id: request.params.bid - }, - include: [{ model: a, where: {