{{ message }}
refactor: consistent remove, perf selector, deps, tests#438
Open
fratzinger wants to merge 2 commits into
Open
Conversation
- .remove() behaves the same way as other methods, do a `._get()` with `raw: false` - selector only when necessary - update dependencies - update tests with NotFound integer id
Contributor
| import { _ } from '@feathersjs/commons'; | ||
| import { | ||
| select as selector, | ||
| select as _selector, |
Contributor
There was a problem hiding this comment.
I think we can just import this as select without having to rename it now. Adding selector as a method cleans up the code/renaming stuff.
| const select = isPresent(sequelizeOptions.attributes) ? this.selector(params) : undefined; | ||
| const result = instances.map((instance) => { | ||
| if (isPresent(sequelizeOptions.attributes)) { | ||
| if (select) { |
Contributor
There was a problem hiding this comment.
If we update this.select, then this code simplifies to
if (isPresent(sequelizeOptions.attributes)) {
return this.select(instance.toJSON(), params);
}| return sequelize; | ||
| } | ||
|
|
||
| private selector (params?: ServiceParams) { |
Contributor
There was a problem hiding this comment.
Not to be nit-picky about naming stuff, but I think this can be select instead of selector. Like I said above, if we don't have to rename the select import from commons, there is no longer a need to invent a new word selector.
Contributor
There was a problem hiding this comment.
Even better. Let's change this to
select(data, params) {
return select(params, this.id)(data)
}| if (isPresent(sequelizeOptions.attributes)) { | ||
| const select = this.selector(params); | ||
| const result = instances.map((instance) => { | ||
| const result = select(instance.toJSON()) |
Contributor
There was a problem hiding this comment.
Same here. If we update this.select, then this code simplifies to
const result = this.select(instance.toJSON(), params)
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

._get()withraw: false