This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new a3f285219 fix: error on deleting wehook connection (#5694)
a3f285219 is described below
commit a3f28521942e4788474667881cb9d736cfeb99f1
Author: Liang Zhang <[email protected]>
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 {