Skip to content
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

Issue #113: Model.create ignoring field and virtual setters #114

Merged
merged 1 commit into from
Jun 9, 2017

Conversation

buske
Copy link
Contributor

@buske buske commented May 10, 2017

This PR solves the problem by making the behaviour of feathers-sequelize's raw parameter consistent across service methods and take priority over the behaviour of sequelize's raw parameter for Model.create calls (in which raw means something completely different). It introduces a sequelize.ignoreSetters argument to control the shadowed Model.create raw parameter.

Without this PR, the following behaviour is observed:

  • service.create(data) — setters ignored
  • service.create(data, {raw: false}) — setters called, but DAO returned

The desired default behaviour is to have setters called but JSON returned, which this PR achieves. To get the native behaviour of calling Model.create({raw: true}), you can now call:
service.create(data, {sequelize: {ignoreSetters: true}})

This PR should be accompanied by a corresponding update to the docs to describe the new ignoreSetters argument: https://docs.feathersjs.com/api/databases/sequelize.html

@daffl
Copy link
Member

daffl commented Jun 9, 2017

Makes sense, thanks a lot @buske!

@daffl daffl merged commit 5911114 into feathersjs-ecosystem:master Jun 9, 2017
@daffl
Copy link
Member

daffl commented Jun 9, 2017

Released as v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants