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
commit 13af44060c0dd5302c024985a860d831e642a132 Author: abeizn <[email protected]> AuthorDate: Wed Jun 29 12:01:39 2022 +0800 fix: ae miss connection id --- plugins/ae/api/connection.go | 15 -------------- plugins/ae/api/init.go | 39 +++++++++++++++++++++++++++++++++++ plugins/ae/tasks/commits_collector.go | 1 + 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/plugins/ae/api/connection.go b/plugins/ae/api/connection.go index 9dc2119b..b84f7998 100644 --- a/plugins/ae/api/connection.go +++ b/plugins/ae/api/connection.go @@ -25,28 +25,13 @@ import ( "github.com/apache/incubator-devlake/plugins/ae/models" "github.com/apache/incubator-devlake/plugins/core" "github.com/apache/incubator-devlake/plugins/helper" - "github.com/go-playground/validator/v10" "github.com/mitchellh/mapstructure" - "github.com/spf13/viper" - "gorm.io/gorm" ) type ApiMeResponse struct { Name string `json:"name"` } -var vld *validator.Validate -var connectionHelper *helper.ConnectionApiHelper - -func Init(config *viper.Viper, logger core.Logger, database *gorm.DB) { - basicRes := helper.NewDefaultBasicRes(config, logger, database) - vld = validator.New() - connectionHelper = helper.NewConnectionHelper( - basicRes, - vld, - ) -} - /* GET /plugins/ae/test/ */ diff --git a/plugins/ae/api/init.go b/plugins/ae/api/init.go new file mode 100644 index 00000000..6774e148 --- /dev/null +++ b/plugins/ae/api/init.go @@ -0,0 +1,39 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package api + +import ( + "github.com/apache/incubator-devlake/plugins/core" + "github.com/apache/incubator-devlake/plugins/helper" + "github.com/go-playground/validator/v10" + "github.com/spf13/viper" + "gorm.io/gorm" +) + +var vld *validator.Validate +var connectionHelper *helper.ConnectionApiHelper +var basicRes core.BasicRes + +func Init(config *viper.Viper, logger core.Logger, database *gorm.DB) { + basicRes = helper.NewDefaultBasicRes(config, logger, database) + vld = validator.New() + connectionHelper = helper.NewConnectionHelper( + basicRes, + vld, + ) +} diff --git a/plugins/ae/tasks/commits_collector.go b/plugins/ae/tasks/commits_collector.go index 0864e2bb..2786a3ac 100644 --- a/plugins/ae/tasks/commits_collector.go +++ b/plugins/ae/tasks/commits_collector.go @@ -36,6 +36,7 @@ func CollectCommits(taskCtx core.SubTaskContext) error { RawDataSubTaskArgs: helper.RawDataSubTaskArgs{ Ctx: taskCtx, Params: AeApiParams{ + ConnectionId: data.Options.ConnectionId, ProjectId: data.Options.ProjectId, }, Table: RAW_COMMITS_TABLE,
