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

Fixed issue where params are ignored on update service calls. #235

Conversation

AndrewJDR
Copy link
Contributor

@AndrewJDR AndrewJDR commented Sep 6, 2018

This is a resolution for issue #234. I will paste the content of the issue report below:

Take a look at these two lines:

return this._get(id, { sequelize: { raw: false }, query: where }).then(instance => {

return instance.update(copy, {raw: false}).then(() => this._get(id, {sequelize: options}));

Lines like these do overrides such as raw: false, which is totally fine, but in the process they also fail to pass through the other attributes of the params object that was provided by the original caller of the service method (further up the callstack).

When a service call is made by some featherjs user's code, it's important to preserve the params object when making any subsequent service calls, as it's possible that the user of feathersjs intends to use these parameters as part of a getModel() override function in a custom service class (i.e. class MySpecialService extends Service with an overidden getModel()) For things like multi-tenancy schemes (hosting multiple domains/sites out of a single app instance such that each site needs to hit a different database).

Any practice of ignoring/clobbering the params passed in will cause problems for such a scheme.

For the most part I have not noticed an issue with this -- As far as I know, get, find, and most other service calls do not have this practice of completely overriding the params with their own value, but update does have this issue. I will submit a pull request for this.

@AndrewJDR
Copy link
Contributor Author

(I'm not really sure why this is failing... maybe someone with deeper feathers experience can take a look?)

@daffl
Copy link
Member

daffl commented Oct 29, 2018

Closed via #243

@daffl daffl closed this Oct 29, 2018
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