-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Improve][ISSUE-3472] Improve streampark-console module Controller #3481
Conversation
still working... |
707dd21
to
2f4bcdc
Compare
@wolfboys pls take a look. |
Hello, thank you for your contribution |
@@ -83,16 +83,15 @@ public RestResponse updateAlertConfig(@RequestBody AlertConfigParams params) { | |||
|
|||
@Operation(summary = "Get alert config") | |||
@PostMapping("/get") | |||
public RestResponse getAlertConfig(@RequestBody AlertConfigParams params) { | |||
AlertConfig alertConfig = alertConfigService.getById(params.getId()); | |||
public RestResponse getAlertConfig(Long id) { |
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'm not sure if its scalability is a consideration here
I don't think it's good to change it to a parameter
@RocMarshal If you have time, can you help review this PR? Thank you. |
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.
Hi, @zzzk1 Thanks for your contribution and for @caicancai review.
To be honest, I'm more inclined towards the scope of responsibilities in this proposal-1, so I would prefer to discard changes that are not within the scope of the proposal in the current PR.
Of course, we'd be glad to consider accepting changes beyond the scope, but we need to make this decision through some necessary discussions.
So, in short, if you want to quickly merge this PR, you can remove changes that are not within the proposal scope; If you wish to merge all the contents of this PR, we look forward to you initiating this discussion to determine whether new rules can be introduced. Please relax, this does not mean that additional changes are incorrect, it just requires a community oriented discussion process.
Please let me know what's your opinion~
Hi @RocMarshal , I think the following coding rules can be introduced
|
Here I think we can’t just look at the current interface design of sp. We must consider the scalability of the sp controller interface. You have to ensure that other parameters in the entire object will not be used in the future. I have to say that sp still has a lot of potential here. There is room for improvement. I cannot guarantee that the parameters in the object will not be used in the future. |
hi @zzzk1
PermissionAction is an annotation used to verify user permissions, This annotation, in conjunction with StreamParkAspect, obtains the required parameters, such as appid and teamid, before the execution of the controller method, and performs logical judgment and interception in the aspect. Therefore, the controller layer still needs to use beans to receive parameters from the frontend and cannot be change like this PR, But when the controller layer calls a method in the service layer, we can pass specific parameters(e.g: Long id) instead of a bean. I think this part can be improved. I'd love to hear your further thoughts on this. 😊 |
@@ -166,16 +166,16 @@ public RestResponse mapping(Application app) { | |||
@PermissionAction(id = "#app.id", type = PermissionTypeEnum.APP) |
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.
We can't make this change because it would cause the annotations to not work. 😕
f6f6407
to
6b9214f
Compare
What changes were proposed in this pull request
Issue Number: close #3472
For controllers that use only a single field, but whose argument is an object, use a single field instead of an object.
Brief change log
Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
Does this pull request potentially affect one of the following parts