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
fix(cli): reorder where and body in CLI template for updateAll #1504
Conversation
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.
Does it make sense to update the order of the parameters passed into the controller method? -- Switching the order of @param.query.string
and @requestBody
?
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.
LGTM
Does it make sense to update the order of the parameters passed into the controller method? -- Switching the order of @param.query.string and @requestbody?
I would +1. In the legacy-juggler-bridge where
in updateAll
is optional, which also makes sense to me for the new updateAll
controller method.
The current code has where
as a required input, so the order doesn't seem that important to me.
+1 for changing the order of controller method arguments too, and also making the |
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.
+1 for changing order of controller method arguments and making where object optional.
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.
LGTM otherwise!
6402d9c
to
82794e7
Compare
): Promise<number> { | ||
return await this.<%= repositoryNameCamel %>.updateAll(where, obj); | ||
return await this.<%= repositoryNameCamel %>.updateAll(obj, where); |
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.
Should the obj to be Partial<<%= modelName %>>
?
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.
Yeah it should be, but from what i remember of #1179, this should incorrectly generate the schema, so it's something that should probably be avoided until it can be fixed
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.
I see. It's probably time to introduce a @type
decorator.
213f250
to
c706982
Compare
docs/site/Controller-generator.md
Outdated
@requestBody() obj: Todo, | ||
@param.query.string('where') where?: Where, | ||
): Promise<number> { | ||
return await this.todoRepository.updateAll(where, obj); |
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.
This should be updated to be obj, where
?
ee786ad
to
8455e89
Compare
…ke where optional
Current way the call is made with updateAll in the CRUD CLI template:
return await this.<%= repositoryNameCamel %>.updateAll(where, obj);
Signature of
updateAll
:The where object and the body need to be switched around
fixes #1521
Checklist
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated