fix(one-to-one): should not require an id for the second model, because there is only one anyways
This commit is contained in:
parent
5e0eeccbac
commit
aebff50d0b
@ -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": {
|
||||
|
@ -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}`,
|
||||
|
@ -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: {
|
||||
|
Loading…
Reference in New Issue
Block a user