You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2023/07/18 14:24:30 UTC

[incubator-devlake] branch release-v0.18 updated: fix: error on deleting wehook connection (#5694)

This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch release-v0.18
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/release-v0.18 by this push:
     new ccb16b6c3 fix: error on deleting wehook connection (#5694)
ccb16b6c3 is described below

commit ccb16b6c3b7964fb591833efc1ad8fc68e78fbb6
Author: Liang Zhang <li...@merico.dev>
AuthorDate: Tue Jul 18 20:48:42 2023 +0800

    fix: error on deleting wehook connection (#5694)
---
 backend/plugins/webhook/api/connection.go | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/backend/plugins/webhook/api/connection.go b/backend/plugins/webhook/api/connection.go
index 0b6b061da..36cf66fad 100644
--- a/backend/plugins/webhook/api/connection.go
+++ b/backend/plugins/webhook/api/connection.go
@@ -19,7 +19,9 @@ package api
 
 import (
 	"fmt"
+	"github.com/apache/incubator-devlake/core/dal"
 	"net/http"
+	"strconv"
 
 	"github.com/apache/incubator-devlake/core/errors"
 	"github.com/apache/incubator-devlake/core/plugin"
@@ -73,7 +75,15 @@ func PatchConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput,
 // @Failure 500  {string} errcode.Error "Internal Error"
 // @Router /plugins/webhook/connections/{connectionId} [DELETE]
 func DeleteConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
-	return connectionHelper.Delete(&models.WebhookConnection{}, input)
+	connectionId, e := strconv.ParseInt(input.Params["connectionId"], 10, 64)
+	if e != nil {
+		return nil, errors.BadInput.WrapRaw(e)
+	}
+	err := basicRes.GetDal().Delete(&models.WebhookConnection{}, dal.Where("id = ?", connectionId))
+	if err != nil {
+		return nil, err
+	}
+	return &plugin.ApiResourceOutput{Status: http.StatusOK}, nil
 }
 
 type WebhookConnectionResponse struct {