You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2023/01/10 07:54:45 UTC

[GitHub] [incubator-devlake] mindlesscloud opened a new pull request, #4172: fix: add unique index for the name of transformation rule

mindlesscloud opened a new pull request, #4172:
URL: https://github.com/apache/incubator-devlake/pull/4172

   ### Summary
   ## Database
   add a unique index for the column `name` of the following tables:
   - `_tool_github_transformation_rules`
   - `_tool_gitlab_transformation_rules`
   - `_tool_jenkins_transformation_rules`
   - `_tool_jira_transformation_rules`
   
   ## API
   empty or duplicate `name` value will return an error of `400 bad request` for the following API
   - POST /plugins/github/transformation_rules
   - POST /plugins/jigitlabra/transformation_rules
   - POST /plugins/jenkins/transformation_rules
   - POST /plugins/jira/transformation_rules
   - PATCH /plugins/github/transformation_rules/{id}
   - PATCH /plugins/jigitlabra/transformation_rules/{id}
   - PATCH /plugins/jenkins/transformation_rules/{id}
   - PATCH /plugins/jira/transformation_rules/{id}
   
   ### Screenshots
   ![31264ab0-0901-4370-9fff-1fe923dfd376](https://user-images.githubusercontent.com/8455907/211493037-657fc741-d55c-4ffc-b94a-a695f841ecc1.jpeg)
   ![361f668d-cce3-4f88-83bd-80cd20920c1c](https://user-images.githubusercontent.com/8455907/211493075-59948e42-8ade-4351-8d90-b6e16a070286.jpeg)
   
   
   ### Other Information
   Any other information that is important to this PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] likyh merged pull request #4172: fix: add unique index for the name of transformation rule

Posted by GitBox <gi...@apache.org>.
likyh merged PR #4172:
URL: https://github.com/apache/incubator-devlake/pull/4172


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mindlesscloud commented on a diff in pull request #4172: fix: add unique index for the name of transformation rule

Posted by GitBox <gi...@apache.org>.
mindlesscloud commented on code in PR #4172:
URL: https://github.com/apache/incubator-devlake/pull/4172#discussion_r1065517834


##########
plugins/github/api/transformation_rule.go:
##########
@@ -63,12 +66,12 @@ func CreateTransformationRule(input *core.ApiResourceInput) (*core.ApiResourceOu
 // @Failure 500  {object} shared.ApiBody "Internal Error"
 // @Router /plugins/github/transformation_rules/{id} [PATCH]
 func UpdateTransformationRule(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
-	transformationRuleId, err := strconv.ParseUint(input.Params["id"], 10, 64)
-	if err != nil {
-		return nil, errors.Default.Wrap(err, "the transformation rule ID should be an integer")
+	transformationRuleId, e := strconv.ParseUint(input.Params["id"], 10, 64)
+	if e != nil {
+		return nil, errors.Default.Wrap(e, "the transformation rule ID should be an integer")

Review Comment:
   The `ParseUint` returns a standard go-type error, but the function `IsDuplicationError` only accepts the `errors.Error` type variable.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] likyh commented on a diff in pull request #4172: fix: add unique index for the name of transformation rule

Posted by GitBox <gi...@apache.org>.
likyh commented on code in PR #4172:
URL: https://github.com/apache/incubator-devlake/pull/4172#discussion_r1065512580


##########
plugins/github/api/transformation_rule.go:
##########
@@ -63,12 +66,12 @@ func CreateTransformationRule(input *core.ApiResourceInput) (*core.ApiResourceOu
 // @Failure 500  {object} shared.ApiBody "Internal Error"
 // @Router /plugins/github/transformation_rules/{id} [PATCH]
 func UpdateTransformationRule(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
-	transformationRuleId, err := strconv.ParseUint(input.Params["id"], 10, 64)
-	if err != nil {
-		return nil, errors.Default.Wrap(err, "the transformation rule ID should be an integer")
+	transformationRuleId, e := strconv.ParseUint(input.Params["id"], 10, 64)
+	if e != nil {
+		return nil, errors.Default.Wrap(e, "the transformation rule ID should be an integer")

Review Comment:
   why create another error var?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org