-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Options param support for create method #26
Conversation
Options param support for create method
Thanks @rafalszemraj. Ideally we'd want to test for this. Since this is a such a benign change I'll add it and we can go back an add a specific test for passing options to Sequelize. |
Options param support for create method
I've published v1.1.3 that contains this fix. |
I'm not sure if this is the best fix.There is a chance that you can mess directly with the database by passing arbitrary query parameters from the client. Instead of using |
@daffl Probably you're right. The reason I wanted to have this is to be able to create records with n:m association . I'm just starting with feathers and I can see that relation model form sequelize is not yet provided (maybe you do not have any plans to do so?). Anyway, starting this with change like this it's not best idea I guess - whole thing needs to be planned beforehand. I can leave without that, you can revert that if you do not feel this is right way to do it. |
Ah shit! I missed that. Good catch @daffl. I think we should roll this change back then. Looks like we are missing documentation on the |
No need to roll it back, this is a good fix. We just need to change https://github.com/feathersjs/feathers-sequelize/blob/master/src/index.js#L83-L89 to create(data, params) {
const options = params.sequelize || {};
if (Array.isArray(data)) {
return this.Model.bulkCreate(data, options).catch(utils.errorHandler);
}
return this.Model.create(data, options).catch(utils.errorHandler);
} Then one can set |
Ah ok cool. I'll fix that right away and do a new patch release. |
@rafalszemraj I hope that works for you as well and many thanks again for the PR! |
👍 |
Fix for #25