Hello, When I try to access one of the endpoints created by the plugin, i get the following error 'ReferenceError: Uncaught error: regeneratorRuntime is not defined'. I suppose it is related to babel. Do I need to add any extra configuration to babel on my app to make the plugin work as it should?
Hello, When I try to access one of the endpoints created by the plugin, i get the following error 'ReferenceError: Uncaught error: regeneratorRuntime is not defined'. I suppose it is related to babel. Do I need to add any extra configuration to babel on my app to make the plugin work as it should?
Ok! Thanks! It is working. Another question i would like to ask you is how the one-to-one and one-to-many relations should be defined in order for the crud to work because i'm having a problem with using the POST method for that:
let's say i have the following relations: team.hasMany(players) player.belongsTo(team)
when i try to create a player with the POST '/team/{teamId}/player' i get the following error:
method is not a function at handler$ (.../hapi-sequelize-test/node_modules/hapi-sequelize-crud3/build/associations/one-to-one.js:120:45)
from what i could gather after looking at the code is that the problem comes from the getMethod() function from the utils.js because it is trying to get the method 'createplayer' from the model that is passed to the function which is the team model.
Is this related to the way you should define the relations? or are you creating these create functions when defining the relations?
Ok! Thanks! It is working. Another question i would like to ask you is how the one-to-one and one-to-many relations should be defined in order for the crud to work because i'm having a problem with using the POST method for that:
let's say i have the following relations:
`team.hasMany(players)
player.belongsTo(team)`
when i try to create a player with the POST '/team/{teamId}/player' i get the following error:
`method is not a function
at handler$ (.../hapi-sequelize-test/node_modules/hapi-sequelize-crud3/build/associations/one-to-one.js:120:45)`
from what i could gather after looking at the code is that the problem comes from the getMethod() function from the utils.js because it is trying to get the method 'createplayer' from the model that is passed to the function which is the team model.
Is this related to the way you should define the relations? or are you creating these create functions when defining the relations?
I'm not really sure about your case, but it should work fine if you use Team.hasMany(Player) and Player.belongsTo(Team).
@FoxMcCloudDX
The methods should work fine if you define relations correctly.
See this file as an example of how I've defined my relations:
https://github.com/mdibaiee/teamline/blob/master/src/relations.js
I'm not really sure about your case, but it should work fine if you use `Team.hasMany(Player)` and `Player.belongsTo(Team)`.
Hello again! I noticed that on your latest fix to this issue you added require('babel/polyfill') instead of 'babel-polyfill' and neither one is a dependency for your project. is there a reason why you are usin the '/' instead of '-'? and would it be best to add the babel-polyfill to your package.json?
Hello again! I noticed that on your latest fix to this issue you added require('babel/polyfill') instead of 'babel-polyfill' and neither one is a dependency for your project. is there a reason why you are usin the '/' instead of '-'? and would it be best to add the babel-polyfill to your package.json?
@FoxMcCloudDX Hey! that's because we use babel@5, the reason being decorators. Decorators are disabled, pending proposal update in babel@6, and babel/polyfill is the way to go when using babel@5.
Ah, you're right, I had to add babel it to dependencies, and I just did (hapi-sequelize-crud@2.0.10). Thanks for noting!
@FoxMcCloudDX Hey! that's because we use babel@5, the reason being decorators. [Decorators are disabled, pending proposal update](http://babeljs.io/docs/plugins/preset-stage-1/) in babel@6, and `babel/polyfill` is the way to go when using babel@5.
Ah, you're right, I had to add `babel` it to dependencies, and I just did (`hapi-sequelize-crud@2.0.10`). Thanks for noting!
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Hello, When I try to access one of the endpoints created by the plugin, i get the following error 'ReferenceError: Uncaught error: regeneratorRuntime is not defined'. I suppose it is related to babel. Do I need to add any extra configuration to babel on my app to make the plugin work as it should?
Hey,
I had forgotten to require
babel/polyfillif it's not already required. I just published an update with the fix.hapi-sequelize-crud@2.0.9Ok! Thanks! It is working. Another question i would like to ask you is how the one-to-one and one-to-many relations should be defined in order for the crud to work because i'm having a problem with using the POST method for that:
let's say i have the following relations:
team.hasMany(players) player.belongsTo(team)when i try to create a player with the POST '/team/{teamId}/player' i get the following error:
method is not a function at handler$ (.../hapi-sequelize-test/node_modules/hapi-sequelize-crud3/build/associations/one-to-one.js:120:45)from what i could gather after looking at the code is that the problem comes from the getMethod() function from the utils.js because it is trying to get the method 'createplayer' from the model that is passed to the function which is the team model.
Is this related to the way you should define the relations? or are you creating these create functions when defining the relations?
@FoxMcCloudDX
The methods should work fine if you define relations correctly.
See this file as an example of how I've defined my relations:
https://github.com/mdibaiee/teamline/blob/master/src/relations.js
I'm not really sure about your case, but it should work fine if you use
Team.hasMany(Player)andPlayer.belongsTo(Team).Hello again! I noticed that on your latest fix to this issue you added require('babel/polyfill') instead of 'babel-polyfill' and neither one is a dependency for your project. is there a reason why you are usin the '/' instead of '-'? and would it be best to add the babel-polyfill to your package.json?
@FoxMcCloudDX Hey! that's because we use babel@5, the reason being decorators. Decorators are disabled, pending proposal update in babel@6, and
babel/polyfillis the way to go when using babel@5.Ah, you're right, I had to add
babelit to dependencies, and I just did (hapi-sequelize-crud@2.0.10). Thanks for noting!