-
Notifications
You must be signed in to change notification settings - Fork 7
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
Bugfix model #17
base: master
Are you sure you want to change the base?
Bugfix model #17
Conversation
@pgrund Could you please remove code styling changes in |
And could you also please add some tests for that change? |
sorry, summer break ... will continue on this topic latest next week ... |
lib/helpers/generateFilterType.ts
Outdated
@@ -24,7 +24,8 @@ export const createFilterType = (type: Function) => { | |||
const typeGraphQLMetadata = getTypeGraphQLMetadataStorage(); | |||
|
|||
const objectTypesList = typeGraphQLMetadata.objectTypes; | |||
const graphQLModel = objectTypesList.find((ot) => types.includes(ot.target) && (typeGraphQLMetadata.inputTypes.findIndex(it => it.name === (ot.name + "Filter")) < 0)) | |||
const graphQLModels = objectTypesList.filter((ot) => types.includes(ot.target) && (typeGraphQLMetadata.inputTypes.findIndex(it => it.name === (ot.name + "Filter")) < 0)); | |||
const graphQLModel = graphQLModels.find(m => m.name === type.name) || graphQLModels.slice(-1).pop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although, it's not critical in this particular case, but it would be better to use graphQLModels[graphQLModels.length - 1]
to get last value of array instead of graphQLModels.slice(-1).pop()
(to avoid redundant copying of an array)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch .. leftover from some intermediate steps ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good 👍
finding correct graphqlmodel, if not there take "closest" parent (inheritance)