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 bc9820e5a refactor: rename transformation rule to scope config - tapd
(#5328)
bc9820e5a is described below
commit bc9820e5a7507333550480854cad163ef171bed6
Author: Klesh Wong <[email protected]>
AuthorDate: Wed May 31 17:28:27 2023 +0800
refactor: rename transformation rule to scope config - tapd (#5328)
---
backend/plugins/jira/api/blueprint_v200_test.go | 2 +-
backend/plugins/tapd/api/blueprint_v200.go | 42 +++++++++--
backend/plugins/tapd/api/blueprint_v200_test.go | 26 ++++---
backend/plugins/tapd/api/init.go | 10 +--
backend/plugins/tapd/api/scope.go | 2 +-
backend/plugins/tapd/api/scope_config.go | 83 ++++++++++++++++++++++
backend/plugins/tapd/api/swagger.go | 56 +++------------
backend/plugins/tapd/api/transformation_rule.go | 83 ----------------------
backend/plugins/tapd/e2e/bug_changelog_test.go | 5 +-
backend/plugins/tapd/e2e/bugs_test.go | 5 +-
backend/plugins/tapd/e2e/stories_test.go | 13 ++--
backend/plugins/tapd/e2e/story_changelog_test.go | 5 +-
backend/plugins/tapd/e2e/task_changelog_test.go | 5 +-
backend/plugins/tapd/e2e/tasks_test.go | 5 +-
backend/plugins/tapd/impl/impl.go | 28 ++++----
.../migrationscripts/20230531_scope_config.go | 56 +++++++++++++++
.../tapd/models/migrationscripts/register.go | 1 +
.../{transformation_rule.go => scope_config.go} | 17 ++---
backend/plugins/tapd/models/workspace.go | 58 +++++++--------
backend/plugins/tapd/tasks/shared.go | 21 +++---
backend/plugins/tapd/tasks/task_data.go | 20 +++---
21 files changed, 305 insertions(+), 238 deletions(-)
diff --git a/backend/plugins/jira/api/blueprint_v200_test.go
b/backend/plugins/jira/api/blueprint_v200_test.go
index 94c554261..da4fafc83 100644
--- a/backend/plugins/jira/api/blueprint_v200_test.go
+++ b/backend/plugins/jira/api/blueprint_v200_test.go
@@ -44,7 +44,7 @@ func TestMakeDataSourcePipelinePlanV200(t *testing.T) {
bpScopes := make([]*plugin.BlueprintScopeV200, 0)
bpScopes = append(bpScopes, bs)
plan := make(plugin.PipelinePlan, len(bpScopes))
- basicRes = NewMockBasicRes()
+ basicRes := NewMockBasicRes()
plan, err = makeDataSourcePipelinePlanV200(basicRes, nil, plan,
bpScopes, uint64(1), syncPolicy)
assert.Nil(t, err)
scopes, err := makeScopesV200(basicRes, bpScopes, uint64(1))
diff --git a/backend/plugins/tapd/api/blueprint_v200.go
b/backend/plugins/tapd/api/blueprint_v200.go
index d46734b63..5ec8ad7ef 100644
--- a/backend/plugins/tapd/api/blueprint_v200.go
+++ b/backend/plugins/tapd/api/blueprint_v200.go
@@ -22,6 +22,7 @@ import (
"strconv"
"time"
+ "github.com/apache/incubator-devlake/core/context"
"github.com/apache/incubator-devlake/core/dal"
"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/core/models/domainlayer"
@@ -35,11 +36,11 @@ import (
func MakeDataSourcePipelinePlanV200(subtaskMetas []plugin.SubTaskMeta,
connectionId uint64, bpScopes []*plugin.BlueprintScopeV200, syncPolicy
*plugin.BlueprintSyncPolicy) (plugin.PipelinePlan, []plugin.Scope,
errors.Error) {
plan := make(plugin.PipelinePlan, len(bpScopes))
- plan, err := makeDataSourcePipelinePlanV200(subtaskMetas, plan,
bpScopes, connectionId, syncPolicy)
+ plan, err := makeDataSourcePipelinePlanV200(basicRes, subtaskMetas,
plan, bpScopes, connectionId, syncPolicy)
if err != nil {
return nil, nil, err
}
- scopes, err := makeScopesV200(bpScopes, connectionId)
+ scopes, err := makeScopesV200(basicRes, bpScopes, connectionId)
if err != nil {
return nil, nil, err
}
@@ -47,7 +48,23 @@ func MakeDataSourcePipelinePlanV200(subtaskMetas
[]plugin.SubTaskMeta, connectio
return plan, scopes, nil
}
+func getScopeConfigByScopeId(basicRes context.BasicRes, scopeId string)
(*models.TapdScopeConfig, errors.Error) {
+ db := basicRes.GetDal()
+ scopeConfig := &models.TapdScopeConfig{}
+ err := db.First(scopeConfig,
+ dal.Select("sc.*"),
+ dal.From("_tool_tapd_scope_configs sc"),
+ dal.Join("LEFT JOIN _tool_tapd_workspaces b ON
(b.scope_config_id = sc.id)"),
+ dal.Where("b.id = ?", scopeId),
+ )
+ if err != nil {
+ return nil, err
+ }
+ return scopeConfig, nil
+}
+
func makeDataSourcePipelinePlanV200(
+ basicRes context.BasicRes,
subtaskMetas []plugin.SubTaskMeta,
plan plugin.PipelinePlan,
bpScopes []*plugin.BlueprintScopeV200,
@@ -71,7 +88,12 @@ func makeDataSourcePipelinePlanV200(
options["timeAfter"] =
syncPolicy.TimeAfter.Format(time.RFC3339)
}
- subtasks, err := helper.MakePipelinePlanSubtasks(subtaskMetas,
bpScope.Entities)
+ scopeConfig, err := getScopeConfigByScopeId(basicRes,
bpScope.Id)
+ if err != nil {
+ return nil, err
+ }
+
+ subtasks, err := helper.MakePipelinePlanSubtasks(subtaskMetas,
scopeConfig.Entities)
if err != nil {
return nil, err
}
@@ -86,7 +108,11 @@ func makeDataSourcePipelinePlanV200(
return plan, nil
}
-func makeScopesV200(bpScopes []*plugin.BlueprintScopeV200, connectionId
uint64) ([]plugin.Scope, errors.Error) {
+func makeScopesV200(
+ basicRes context.BasicRes,
+ bpScopes []*plugin.BlueprintScopeV200,
+ connectionId uint64) ([]plugin.Scope, errors.Error,
+) {
scopes := make([]plugin.Scope, 0)
for _, bpScope := range bpScopes {
tapdWorkspace := &models.TapdWorkspace{}
@@ -97,8 +123,14 @@ func makeScopesV200(bpScopes []*plugin.BlueprintScopeV200,
connectionId uint64)
if err != nil {
return nil, errors.Default.Wrap(err, fmt.Sprintf("fail
to find wrokspace %s", bpScope.Id))
}
+
+ scopeConfig, err := getScopeConfigByScopeId(basicRes,
bpScope.Id)
+ if err != nil {
+ return nil, err
+ }
+
// add wrokspace to scopes
- if utils.StringsContains(bpScope.Entities,
plugin.DOMAIN_TYPE_TICKET) {
+ if utils.StringsContains(scopeConfig.Entities,
plugin.DOMAIN_TYPE_TICKET) {
domainBoard := &ticket.Board{
DomainEntity: domainlayer.DomainEntity{
Id:
didgen.NewDomainIdGenerator(&models.TapdWorkspace{}).Generate(tapdWorkspace.ConnectionId,
tapdWorkspace.Id),
diff --git a/backend/plugins/tapd/api/blueprint_v200_test.go
b/backend/plugins/tapd/api/blueprint_v200_test.go
index 4e43d409f..043b973c6 100644
--- a/backend/plugins/tapd/api/blueprint_v200_test.go
+++ b/backend/plugins/tapd/api/blueprint_v200_test.go
@@ -18,6 +18,9 @@ limitations under the License.
package api
import (
+ "testing"
+
+ "github.com/apache/incubator-devlake/core/models/common"
"github.com/apache/incubator-devlake/core/models/domainlayer"
"github.com/apache/incubator-devlake/core/models/domainlayer/ticket"
"github.com/apache/incubator-devlake/core/plugin"
@@ -27,7 +30,6 @@ import (
"github.com/apache/incubator-devlake/plugins/tapd/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
- "testing"
)
func TestMakeDataSourcePipelinePlanV200(t *testing.T) {
@@ -36,17 +38,16 @@ func TestMakeDataSourcePipelinePlanV200(t *testing.T) {
err := plugin.RegisterPlugin("tapd", mockMeta)
assert.Nil(t, err)
bs := &plugin.BlueprintScopeV200{
- Entities: []string{"TICKET"},
- Id: "10",
+ Id: "10",
}
syncPolicy := &plugin.BlueprintSyncPolicy{}
bpScopes := make([]*plugin.BlueprintScopeV200, 0)
bpScopes = append(bpScopes, bs)
plan := make(plugin.PipelinePlan, len(bpScopes))
- plan, err = makeDataSourcePipelinePlanV200(nil, plan, bpScopes,
uint64(1), syncPolicy)
+ basicRes := NewMockBasicRes()
+ plan, err = makeDataSourcePipelinePlanV200(basicRes, nil, plan,
bpScopes, uint64(1), syncPolicy)
assert.Nil(t, err)
- basicRes = NewMockBasicRes()
- scopes, err := makeScopesV200(bpScopes, uint64(1))
+ scopes, err := makeScopesV200(basicRes, bpScopes, uint64(1))
assert.Nil(t, err)
expectPlan := plugin.PipelinePlan{
@@ -82,14 +83,23 @@ func NewMockBasicRes() *mockcontext.BasicRes {
Id: 10,
Name: "a",
}
+ scopeConfig := &models.TapdScopeConfig{
+ ScopeConfig: common.ScopeConfig{
+ Entities: []string{plugin.DOMAIN_TYPE_TICKET},
+ },
+ }
mockRes := new(mockcontext.BasicRes)
mockDal := new(mockdal.Dal)
- mockDal.On("First", mock.Anything, mock.Anything).Run(func(args
mock.Arguments) {
+ mockDal.On("First", mock.AnythingOfType("*models.TapdScopeConfig"),
mock.Anything).Run(func(args mock.Arguments) {
+ dst := args.Get(0).(*models.TapdScopeConfig)
+ *dst = *scopeConfig
+ }).Return(nil)
+ mockDal.On("First", mock.AnythingOfType("*models.TapdWorkspace"),
mock.Anything).Run(func(args mock.Arguments) {
dst := args.Get(0).(*models.TapdWorkspace)
*dst = *tapdWorkspace
- }).Return(nil).Once()
+ }).Return(nil)
mockRes.On("GetDal").Return(mockDal)
mockRes.On("GetConfig", mock.Anything).Return("")
diff --git a/backend/plugins/tapd/api/init.go b/backend/plugins/tapd/api/init.go
index 42cf79f91..c034961a8 100644
--- a/backend/plugins/tapd/api/init.go
+++ b/backend/plugins/tapd/api/init.go
@@ -27,9 +27,9 @@ import (
var vld *validator.Validate
var connectionHelper *api.ConnectionApiHelper
var basicRes context.BasicRes
-var scopeHelper *api.ScopeApiHelper[models.TapdConnection,
models.TapdWorkspace, models.TapdTransformationRule]
+var scopeHelper *api.ScopeApiHelper[models.TapdConnection,
models.TapdWorkspace, models.TapdScopeConfig]
var remoteHelper *api.RemoteApiHelper[models.TapdConnection,
models.TapdWorkspace, models.TapdWorkspace, api.BaseRemoteGroupResponse]
-var trHelper *api.TransformationRuleHelper[models.TapdTransformationRule]
+var scHelper *api.ScopeConfigHelper[models.TapdScopeConfig]
func Init(br context.BasicRes) {
basicRes = br
@@ -42,11 +42,11 @@ func Init(br context.BasicRes) {
ScopeIdFieldName: "Id",
ScopeIdColumnName: "id",
}
- scopeHelper = api.NewScopeHelper[models.TapdConnection,
models.TapdWorkspace, models.TapdTransformationRule](
+ scopeHelper = api.NewScopeHelper[models.TapdConnection,
models.TapdWorkspace, models.TapdScopeConfig](
basicRes,
vld,
connectionHelper,
- api.NewScopeDatabaseHelperImpl[models.TapdConnection,
models.TapdWorkspace, models.TapdTransformationRule](
+ api.NewScopeDatabaseHelperImpl[models.TapdConnection,
models.TapdWorkspace, models.TapdScopeConfig](
basicRes, connectionHelper, params),
params,
nil,
@@ -56,7 +56,7 @@ func Init(br context.BasicRes) {
vld,
connectionHelper,
)
- trHelper =
api.NewTransformationRuleHelper[models.TapdTransformationRule](
+ scHelper = api.NewScopeConfigHelper[models.TapdScopeConfig](
basicRes,
vld,
)
diff --git a/backend/plugins/tapd/api/scope.go
b/backend/plugins/tapd/api/scope.go
index 5ed0bd109..e8e380888 100644
--- a/backend/plugins/tapd/api/scope.go
+++ b/backend/plugins/tapd/api/scope.go
@@ -27,7 +27,7 @@ import (
type ScopeRes struct {
models.TapdWorkspace
- TransformationRuleName string `json:"transformationRuleName,omitempty"`
+ ScopeConfigName string `json:"scopeConfigName,omitempty"`
}
type TapdScopeReq api.ScopeReq[models.TapdWorkspace]
diff --git a/backend/plugins/tapd/api/scope_config.go
b/backend/plugins/tapd/api/scope_config.go
new file mode 100644
index 000000000..224cf998e
--- /dev/null
+++ b/backend/plugins/tapd/api/scope_config.go
@@ -0,0 +1,83 @@
+/*
+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/core/errors"
+ "github.com/apache/incubator-devlake/core/plugin"
+)
+
+// CreateScopeConfig create scope config for Tapd
+// @Summary create scope config for Tapd
+// @Description create scope config for Tapd
+// @Tags plugins/tapd
+// @Accept application/json
+// @Param connectionId path int true "connectionId"
+// @Param scopeConfig body models.TapdScopeConfig true "scope config"
+// @Success 200 {object} models.TapdScopeConfig
+// @Failure 400 {object} shared.ApiBody "Bad Request"
+// @Failure 500 {object} shared.ApiBody "Internal Error"
+// @Router /plugins/tapd/connections/{connectionId}/scope_configs [POST]
+func CreateScopeConfig(input *plugin.ApiResourceInput)
(*plugin.ApiResourceOutput, errors.Error) {
+ return scHelper.Create(input)
+}
+
+// UpdateScopeConfig update scope config for Tapd
+// @Summary update scope config for Tapd
+// @Description update scope config for Tapd
+// @Tags plugins/tapd
+// @Accept application/json
+// @Param id path int true "id"
+// @Param connectionId path int true "connectionId"
+// @Param scopeConfig body models.TapdScopeConfig true "scope config"
+// @Success 200 {object} models.TapdScopeConfig
+// @Failure 400 {object} shared.ApiBody "Bad Request"
+// @Failure 500 {object} shared.ApiBody "Internal Error"
+// @Router /plugins/tapd/connections/{connectionId}/scope_configs/{id} [PATCH]
+func UpdateScopeConfig(input *plugin.ApiResourceInput)
(*plugin.ApiResourceOutput, errors.Error) {
+ return scHelper.Update(input)
+}
+
+// GetScopeConfig return one scope config
+// @Summary return one scope config
+// @Description return one scope config
+// @Tags plugins/tapd
+// @Param id path int true "id"
+// @Param connectionId path int true "connectionId"
+// @Success 200 {object} models.TapdScopeConfig
+// @Failure 400 {object} shared.ApiBody "Bad Request"
+// @Failure 500 {object} shared.ApiBody "Internal Error"
+// @Router /plugins/tapd/connections/{connectionId}/scope_configs/{id} [GET]
+func GetScopeConfig(input *plugin.ApiResourceInput)
(*plugin.ApiResourceOutput, errors.Error) {
+ return scHelper.Get(input)
+}
+
+// GetScopeConfigList return all scope configs
+// @Summary return all scope configs
+// @Description return all scope configs
+// @Tags plugins/tapd
+// @Param connectionId path int true "connectionId"
+// @Param pageSize query int false "page size, default 50"
+// @Param page query int false "page size, default 1"
+// @Success 200 {object} []models.TapdScopeConfig
+// @Failure 400 {object} shared.ApiBody "Bad Request"
+// @Failure 500 {object} shared.ApiBody "Internal Error"
+// @Router /plugins/tapd/connections/{connectionId}/scope_configs [GET]
+func GetScopeConfigList(input *plugin.ApiResourceInput)
(*plugin.ApiResourceOutput, errors.Error) {
+ return scHelper.List(input)
+}
diff --git a/backend/plugins/tapd/api/swagger.go
b/backend/plugins/tapd/api/swagger.go
index d70fc27f3..da296b302 100644
--- a/backend/plugins/tapd/api/swagger.go
+++ b/backend/plugins/tapd/api/swagger.go
@@ -17,56 +17,16 @@ limitations under the License.
package api
-import "github.com/apache/incubator-devlake/plugins/tapd/tasks"
+import (
+ "github.com/apache/incubator-devlake/plugins/tapd/tasks"
+)
-// @Summary blueprints setting for tapd
-// @Description blueprint setting for tapd
-// @Tags plugins/tapd
-// @Accept application/json
-// @Param blueprint body TapdBlueprintSetting true "json"
-// @Router /blueprints/tapd/blueprint-setting [post]
-func _() {}
+type TapdTaskOptions tasks.TapdOptions
-type TapdBlueprintSetting []struct {
- Version string `json:"version"`
- Connections []struct {
- Plugin string `json:"plugin"`
- ConnectionID int `json:"connectionId"`
- Scope []struct {
- Options struct {
- WorkspaceId uint64
`mapstruct:"workspaceId"`
- CompanyId uint64
`mapstruct:"companyId"`
- Tasks []string
`mapstruct:"tasks,omitempty"`
- Since string
- TransformationRules TransformationRules
`json:"transformationRules"`
- } `json:"options"`
- Entities []string `json:"entities"`
- } `json:"scopes"`
- } `json:"connections"`
-}
-
-// @Summary pipelines plan for tapd
-// @Description pipelines plan for tapd
+// @Summary tapd task options for pipelines
+// @Description This is a dummy API to demonstrate the available task options
for tapd pipelines
// @Tags plugins/tapd
// @Accept application/json
-// @Param pipeline body TapdPipelinePlan true "json"
-// @Router /pipelines/tapd/pipeline-plan [post]
+// @Param pipeline body TapdTaskOptions true "json"
+// @Router /pipelines/tapd/pipeline-task [post]
func _() {}
-
-type TapdPipelinePlan [][]struct {
- Plugin string `json:"plugin"`
- Subtasks []string `json:"subtasks"`
- Options struct {
- ConnectionId uint64 `mapstruct:"connectionId"`
- WorkspaceId uint64 `mapstruct:"workspaceId"`
- CompanyId uint64 `mapstruct:"companyId"`
- Tasks []string `mapstruct:"tasks,omitempty"`
- Since string
- TransformationRules TransformationRules
`json:"transformationRules"`
- } `json:"options"`
-}
-
-type TransformationRules struct {
- TypeMappings tasks.TypeMappings `json:"typeMappings"`
- StatusMappings tasks.StatusMappings `json:"statusMappings"`
-}
diff --git a/backend/plugins/tapd/api/transformation_rule.go
b/backend/plugins/tapd/api/transformation_rule.go
deleted file mode 100644
index 3bd5b0d84..000000000
--- a/backend/plugins/tapd/api/transformation_rule.go
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-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/core/errors"
- "github.com/apache/incubator-devlake/core/plugin"
-)
-
-// CreateTransformationRule create transformation rule for Tapd
-// @Summary create transformation rule for Tapd
-// @Description create transformation rule for Tapd
-// @Tags plugins/tapd
-// @Accept application/json
-// @Param connectionId path int true "connectionId"
-// @Param transformationRule body models.TapdTransformationRule true
"transformation rule"
-// @Success 200 {object} models.TapdTransformationRule
-// @Failure 400 {object} shared.ApiBody "Bad Request"
-// @Failure 500 {object} shared.ApiBody "Internal Error"
-// @Router /plugins/tapd/connections/{connectionId}/transformation_rules [POST]
-func CreateTransformationRule(input *plugin.ApiResourceInput)
(*plugin.ApiResourceOutput, errors.Error) {
- return trHelper.Create(input)
-}
-
-// UpdateTransformationRule update transformation rule for Tapd
-// @Summary update transformation rule for Tapd
-// @Description update transformation rule for Tapd
-// @Tags plugins/tapd
-// @Accept application/json
-// @Param id path int true "id"
-// @Param connectionId path int true "connectionId"
-// @Param transformationRule body models.TapdTransformationRule true
"transformation rule"
-// @Success 200 {object} models.TapdTransformationRule
-// @Failure 400 {object} shared.ApiBody "Bad Request"
-// @Failure 500 {object} shared.ApiBody "Internal Error"
-// @Router /plugins/tapd/connections/{connectionId}/transformation_rules/{id}
[PATCH]
-func UpdateTransformationRule(input *plugin.ApiResourceInput)
(*plugin.ApiResourceOutput, errors.Error) {
- return trHelper.Update(input)
-}
-
-// GetTransformationRule return one transformation rule
-// @Summary return one transformation rule
-// @Description return one transformation rule
-// @Tags plugins/tapd
-// @Param id path int true "id"
-// @Param connectionId path int true "connectionId"
-// @Success 200 {object} models.TapdTransformationRule
-// @Failure 400 {object} shared.ApiBody "Bad Request"
-// @Failure 500 {object} shared.ApiBody "Internal Error"
-// @Router /plugins/tapd/connections/{connectionId}/transformation_rules/{id}
[GET]
-func GetTransformationRule(input *plugin.ApiResourceInput)
(*plugin.ApiResourceOutput, errors.Error) {
- return trHelper.Get(input)
-}
-
-// GetTransformationRuleList return all transformation rules
-// @Summary return all transformation rules
-// @Description return all transformation rules
-// @Tags plugins/tapd
-// @Param connectionId path int true "connectionId"
-// @Param pageSize query int false "page size, default 50"
-// @Param page query int false "page size, default 1"
-// @Success 200 {object} []models.TapdTransformationRule
-// @Failure 400 {object} shared.ApiBody "Bad Request"
-// @Failure 500 {object} shared.ApiBody "Internal Error"
-// @Router /plugins/tapd/connections/{connectionId}/transformation_rules [GET]
-func GetTransformationRuleList(input *plugin.ApiResourceInput)
(*plugin.ApiResourceOutput, errors.Error) {
- return trHelper.List(input)
-}
diff --git a/backend/plugins/tapd/e2e/bug_changelog_test.go
b/backend/plugins/tapd/e2e/bug_changelog_test.go
index 5f00141d4..1d18f1579 100644
--- a/backend/plugins/tapd/e2e/bug_changelog_test.go
+++ b/backend/plugins/tapd/e2e/bug_changelog_test.go
@@ -18,12 +18,13 @@ limitations under the License.
package e2e
import (
+ "testing"
+
"github.com/apache/incubator-devlake/core/models/domainlayer/ticket"
"github.com/apache/incubator-devlake/helpers/e2ehelper"
"github.com/apache/incubator-devlake/plugins/tapd/impl"
"github.com/apache/incubator-devlake/plugins/tapd/models"
"github.com/apache/incubator-devlake/plugins/tapd/tasks"
- "testing"
)
func TestTapdBugChangelogDataFlow(t *testing.T) {
@@ -35,7 +36,7 @@ func TestTapdBugChangelogDataFlow(t *testing.T) {
Options: &tasks.TapdOptions{
ConnectionId: 1,
WorkspaceId: 991,
- TransformationRules: &tasks.TransformationRules{
+ ScopeConfig: &tasks.TapdScopeConfig{
TypeMappings: tasks.TypeMappings{
"Techstory": "REQUIREMENT",
"技术债": "REQUIREMENT",
diff --git a/backend/plugins/tapd/e2e/bugs_test.go
b/backend/plugins/tapd/e2e/bugs_test.go
index c4b33b497..7bdbf4324 100644
--- a/backend/plugins/tapd/e2e/bugs_test.go
+++ b/backend/plugins/tapd/e2e/bugs_test.go
@@ -18,13 +18,14 @@ limitations under the License.
package e2e
import (
+ "testing"
+
"github.com/apache/incubator-devlake/core/models/common"
"github.com/apache/incubator-devlake/core/models/domainlayer/ticket"
"github.com/apache/incubator-devlake/helpers/e2ehelper"
"github.com/apache/incubator-devlake/plugins/tapd/impl"
"github.com/apache/incubator-devlake/plugins/tapd/models"
"github.com/apache/incubator-devlake/plugins/tapd/tasks"
- "testing"
)
func TestTapdBugDataFlow(t *testing.T) {
@@ -36,7 +37,7 @@ func TestTapdBugDataFlow(t *testing.T) {
Options: &tasks.TapdOptions{
ConnectionId: 1,
WorkspaceId: 991,
- TransformationRules: &tasks.TransformationRules{
+ ScopeConfig: &tasks.TapdScopeConfig{
TypeMappings: tasks.TypeMappings{
"BUG": "缺陷",
"TASK": "任务",
diff --git a/backend/plugins/tapd/e2e/stories_test.go
b/backend/plugins/tapd/e2e/stories_test.go
index 19f990785..c72ad77c3 100644
--- a/backend/plugins/tapd/e2e/stories_test.go
+++ b/backend/plugins/tapd/e2e/stories_test.go
@@ -18,13 +18,14 @@ limitations under the License.
package e2e
import (
+ "testing"
+
"github.com/apache/incubator-devlake/core/models/common"
"github.com/apache/incubator-devlake/core/models/domainlayer/ticket"
"github.com/apache/incubator-devlake/helpers/e2ehelper"
"github.com/apache/incubator-devlake/plugins/tapd/impl"
"github.com/apache/incubator-devlake/plugins/tapd/models"
"github.com/apache/incubator-devlake/plugins/tapd/tasks"
- "testing"
)
func TestTapdStoryDataFlow(t *testing.T) {
@@ -36,12 +37,12 @@ func TestTapdStoryDataFlow(t *testing.T) {
Options: &tasks.TapdOptions{
ConnectionId: 1,
WorkspaceId: 991,
- TransformationRules: &tasks.TransformationRules{
+ ScopeConfig: &tasks.TapdScopeConfig{
TypeMappings: tasks.TypeMappings{
- "BUG": "缺陷",
- "TASK": "任务",
- "需求": "故事需求",
- "技术债": "技术需求债务",
+ "BUG": "缺陷",
+ "TASK": "任务",
+ "需求": "故事需求",
+ "技术债": "技术需求债务",
"长篇故事": "Epic需求",
},
},
diff --git a/backend/plugins/tapd/e2e/story_changelog_test.go
b/backend/plugins/tapd/e2e/story_changelog_test.go
index 4a8fcfa18..da42117b3 100644
--- a/backend/plugins/tapd/e2e/story_changelog_test.go
+++ b/backend/plugins/tapd/e2e/story_changelog_test.go
@@ -18,12 +18,13 @@ limitations under the License.
package e2e
import (
+ "testing"
+
"github.com/apache/incubator-devlake/core/models/domainlayer/ticket"
"github.com/apache/incubator-devlake/helpers/e2ehelper"
"github.com/apache/incubator-devlake/plugins/tapd/impl"
"github.com/apache/incubator-devlake/plugins/tapd/models"
"github.com/apache/incubator-devlake/plugins/tapd/tasks"
- "testing"
)
func TestTapdStoryChangelogDataFlow(t *testing.T) {
@@ -35,7 +36,7 @@ func TestTapdStoryChangelogDataFlow(t *testing.T) {
Options: &tasks.TapdOptions{
ConnectionId: 1,
WorkspaceId: 991,
- TransformationRules: &tasks.TransformationRules{
+ ScopeConfig: &tasks.TapdScopeConfig{
TypeMappings: tasks.TypeMappings{
"Techstory": "REQUIREMENT",
"技术债": "REQUIREMENT",
diff --git a/backend/plugins/tapd/e2e/task_changelog_test.go
b/backend/plugins/tapd/e2e/task_changelog_test.go
index 983b8c226..e867048f9 100644
--- a/backend/plugins/tapd/e2e/task_changelog_test.go
+++ b/backend/plugins/tapd/e2e/task_changelog_test.go
@@ -18,12 +18,13 @@ limitations under the License.
package e2e
import (
+ "testing"
+
"github.com/apache/incubator-devlake/core/models/domainlayer/ticket"
"github.com/apache/incubator-devlake/helpers/e2ehelper"
"github.com/apache/incubator-devlake/plugins/tapd/impl"
"github.com/apache/incubator-devlake/plugins/tapd/models"
"github.com/apache/incubator-devlake/plugins/tapd/tasks"
- "testing"
)
func TestTapdTaskChangelogDataFlow(t *testing.T) {
@@ -35,7 +36,7 @@ func TestTapdTaskChangelogDataFlow(t *testing.T) {
Options: &tasks.TapdOptions{
ConnectionId: 1,
WorkspaceId: 991,
- TransformationRules: &tasks.TransformationRules{
+ ScopeConfig: &tasks.TapdScopeConfig{
TypeMappings: tasks.TypeMappings{
"Techstory": "REQUIREMENT",
"技术债": "REQUIREMENT",
diff --git a/backend/plugins/tapd/e2e/tasks_test.go
b/backend/plugins/tapd/e2e/tasks_test.go
index 696651dab..0d9c8569c 100644
--- a/backend/plugins/tapd/e2e/tasks_test.go
+++ b/backend/plugins/tapd/e2e/tasks_test.go
@@ -18,13 +18,14 @@ limitations under the License.
package e2e
import (
+ "testing"
+
"github.com/apache/incubator-devlake/core/models/common"
"github.com/apache/incubator-devlake/core/models/domainlayer/ticket"
"github.com/apache/incubator-devlake/helpers/e2ehelper"
"github.com/apache/incubator-devlake/plugins/tapd/impl"
"github.com/apache/incubator-devlake/plugins/tapd/models"
"github.com/apache/incubator-devlake/plugins/tapd/tasks"
- "testing"
)
func TestTapdTaskDataFlow(t *testing.T) {
@@ -36,7 +37,7 @@ func TestTapdTaskDataFlow(t *testing.T) {
Options: &tasks.TapdOptions{
ConnectionId: 1,
WorkspaceId: 991,
- TransformationRules: &tasks.TransformationRules{
+ ScopeConfig: &tasks.TapdScopeConfig{
TypeMappings: tasks.TypeMappings{
"BUG": "缺陷",
"TASK": "任务",
diff --git a/backend/plugins/tapd/impl/impl.go
b/backend/plugins/tapd/impl/impl.go
index 5bf0e7f1f..f341b48b3 100644
--- a/backend/plugins/tapd/impl/impl.go
+++ b/backend/plugins/tapd/impl/impl.go
@@ -206,20 +206,20 @@ func (p Tapd) PrepareTaskData(taskCtx plugin.TaskContext,
options map[string]int
return nil, errors.Default.Wrap(err, fmt.Sprintf("fail
to find workspace: %d", op.WorkspaceId))
}
op.WorkspaceId = scope.Id
- if op.TransformationRuleId == 0 {
- op.TransformationRuleId = scope.TransformationRuleId
+ if op.ScopeConfigId == 0 {
+ op.ScopeConfigId = scope.ScopeConfigId
}
}
- if op.TransformationRules == nil && op.TransformationRuleId != 0 {
- var transformationRule models.TapdTransformationRule
- err = taskCtx.GetDal().First(&transformationRule, dal.Where("id
= ?", op.TransformationRuleId))
+ if op.ScopeConfig == nil && op.ScopeConfigId != 0 {
+ var scopeConfig models.TapdScopeConfig
+ err = taskCtx.GetDal().First(&scopeConfig, dal.Where("id = ?",
op.ScopeConfigId))
if err != nil && taskCtx.GetDal().IsErrorNotFound(err) {
- return nil, errors.BadInput.Wrap(err, "fail to get
transformationRule")
+ return nil, errors.BadInput.Wrap(err, "fail to get
scopeConfig")
}
- op.TransformationRules, err =
tasks.MakeTransformationRules(transformationRule)
+ op.ScopeConfig, err = tasks.MakeScopeConfigs(scopeConfig)
if err != nil {
- return nil, errors.BadInput.Wrap(err, "fail to make
transformationRule")
+ return nil, errors.BadInput.Wrap(err, "fail to make
scopeConfig")
}
}
@@ -292,13 +292,13 @@ func (p Tapd) ApiResources()
map[string]map[string]plugin.ApiResourceHandler {
"GET": api.GetScopeList,
"PUT": api.PutScope,
},
- "connections/:connectionId/transformation_rules": {
- "POST": api.CreateTransformationRule,
- "GET": api.GetTransformationRuleList,
+ "connections/:connectionId/scope_configs": {
+ "POST": api.CreateScopeConfig,
+ "GET": api.GetScopeConfigList,
},
- "connections/:connectionId/transformation_rules/:id": {
- "PATCH": api.UpdateTransformationRule,
- "GET": api.GetTransformationRule,
+ "connections/:connectionId/scope_configs/:id": {
+ "PATCH": api.UpdateScopeConfig,
+ "GET": api.GetScopeConfig,
},
}
}
diff --git
a/backend/plugins/tapd/models/migrationscripts/20230531_scope_config.go
b/backend/plugins/tapd/models/migrationscripts/20230531_scope_config.go
new file mode 100644
index 000000000..a446bd54d
--- /dev/null
+++ b/backend/plugins/tapd/models/migrationscripts/20230531_scope_config.go
@@ -0,0 +1,56 @@
+/*
+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 migrationscripts
+
+import (
+ "github.com/apache/incubator-devlake/core/context"
+ "github.com/apache/incubator-devlake/core/errors"
+ "github.com/apache/incubator-devlake/helpers/migrationhelper"
+)
+
+type renameTr2ScopeConfig struct {
+}
+
+type scopeConfig20230531 struct {
+ Entities []string `gorm:"type:json" json:"entities"`
+}
+
+func (scopeConfig20230531) TableName() string {
+ return "_tool_tapd_scope_configs"
+}
+
+func (u *renameTr2ScopeConfig) Up(baseRes context.BasicRes) errors.Error {
+ db := baseRes.GetDal()
+ err := db.RenameColumn("_tool_tapd_workspaces",
"transformation_rule_id", "scope_config_id")
+ if err != nil {
+ return err
+ }
+ err = db.RenameTable("_tool_tapd_transformation_rules",
"_tool_tapd_scope_configs")
+ if err != nil {
+ return err
+ }
+ return migrationhelper.AutoMigrateTables(baseRes,
&scopeConfig20230531{})
+}
+
+func (*renameTr2ScopeConfig) Version() uint64 {
+ return 20230531135926
+}
+
+func (*renameTr2ScopeConfig) Name() string {
+ return "rename transformation rule to scope config for tapd"
+}
diff --git a/backend/plugins/tapd/models/migrationscripts/register.go
b/backend/plugins/tapd/models/migrationscripts/register.go
index 6af561d28..749dd3d47 100644
--- a/backend/plugins/tapd/models/migrationscripts/register.go
+++ b/backend/plugins/tapd/models/migrationscripts/register.go
@@ -30,5 +30,6 @@ func All() []plugin.MigrationScript {
new(deleteIssue),
new(modifyCustomFieldName),
new(addCustomFieldValue),
+ new(renameTr2ScopeConfig),
}
}
diff --git a/backend/plugins/tapd/models/transformation_rule.go
b/backend/plugins/tapd/models/scope_config.go
similarity index 58%
rename from backend/plugins/tapd/models/transformation_rule.go
rename to backend/plugins/tapd/models/scope_config.go
index f1b9095d7..756c68b52 100644
--- a/backend/plugins/tapd/models/transformation_rule.go
+++ b/backend/plugins/tapd/models/scope_config.go
@@ -19,17 +19,18 @@ package models
import (
"encoding/json"
+
"github.com/apache/incubator-devlake/core/models/common"
)
-type TapdTransformationRule struct {
- common.Model `mapstructure:"-"`
- ConnectionId uint64 `mapstructure:"connectionId"
json:"connectionId"`
- Name string
`gorm:"type:varchar(255);index:idx_name_tapd,unique" validate:"required"
mapstructure:"name" json:"name"`
- TypeMappings json.RawMessage `mapstructure:"typeMappings,omitempty"
json:"typeMappings"`
- StatusMappings json.RawMessage `mapstructure:"statusMappings,omitempty"
json:"statusMappings"`
+type TapdScopeConfig struct {
+ common.ScopeConfig `mapstructure:",squash" json:",inline"
gorm:"embedded"`
+ ConnectionId uint64 `mapstructure:"connectionId"
json:"connectionId"`
+ Name string
`gorm:"type:varchar(255);index:idx_name_tapd,unique" validate:"required"
mapstructure:"name" json:"name"`
+ TypeMappings json.RawMessage
`mapstructure:"typeMappings,omitempty" json:"typeMappings"`
+ StatusMappings json.RawMessage
`mapstructure:"statusMappings,omitempty" json:"statusMappings"`
}
-func (t TapdTransformationRule) TableName() string {
- return "_tool_tapd_transformation_rules"
+func (t TapdScopeConfig) TableName() string {
+ return "_tool_tapd_scope_configs"
}
diff --git a/backend/plugins/tapd/models/workspace.go
b/backend/plugins/tapd/models/workspace.go
index 151fa1c7b..e576bc422 100644
--- a/backend/plugins/tapd/models/workspace.go
+++ b/backend/plugins/tapd/models/workspace.go
@@ -26,20 +26,20 @@ import (
)
type ApiTapdWorkspace struct {
- ConnectionId uint64 `gorm:"primaryKey;type:BIGINT NOT
NULL"`
- Id uint64 `gorm:"primaryKey;type:BIGINT NOT
NULL;autoIncrement:false" json:"id,string"`
- Name string `gorm:"type:varchar(255)"
json:"name"`
- PrettyName string `gorm:"type:varchar(255)"
json:"pretty_name"`
- Category string `gorm:"type:varchar(255)"
json:"category"`
- Status string `gorm:"type:varchar(255)"
json:"status"`
- Description string `json:"description"`
- BeginDate *helper.CSTTime `json:"begin_date"`
- EndDate *helper.CSTTime `json:"end_date"`
- ExternalOn string `gorm:"type:varchar(255)"
json:"external_on"`
- ParentId uint64 `gorm:"type:BIGINT"
json:"parent_id,string"`
- Creator string `gorm:"type:varchar(255)"
json:"creator"`
- Created *helper.CSTTime `json:"created"`
- TransformationRuleId uint64
`json:"transformationRuleId,omitempty" mapstructure:"transformationRuleId"`
+ ConnectionId uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"`
+ Id uint64 `gorm:"primaryKey;type:BIGINT NOT
NULL;autoIncrement:false" json:"id,string"`
+ Name string `gorm:"type:varchar(255)" json:"name"`
+ PrettyName string `gorm:"type:varchar(255)"
json:"pretty_name"`
+ Category string `gorm:"type:varchar(255)" json:"category"`
+ Status string `gorm:"type:varchar(255)" json:"status"`
+ Description string `json:"description"`
+ BeginDate *helper.CSTTime `json:"begin_date"`
+ EndDate *helper.CSTTime `json:"end_date"`
+ ExternalOn string `gorm:"type:varchar(255)"
json:"external_on"`
+ ParentId uint64 `gorm:"type:BIGINT"
json:"parent_id,string"`
+ Creator string `gorm:"type:varchar(255)" json:"creator"`
+ Created *helper.CSTTime `json:"created"`
+ ScopeConfigId uint64 `json:"scopeConfigId,omitempty"
mapstructure:"scopeConfigId"`
common.NoPKModel
}
@@ -60,21 +60,21 @@ type WorkspaceResponse struct {
}
type TapdWorkspace struct {
- ConnectionId uint64 `gorm:"primaryKey;type:BIGINT NOT
NULL" mapstructure:"connection_id" json:"connection_id"`
- Id uint64 `gorm:"primaryKey;type:BIGINT"
mapstructure:"id" json:"id"`
- Name string `gorm:"type:varchar(255)"
mapstructure:"name" json:"name"`
- PrettyName string `gorm:"type:varchar(255)"
mapstructure:"pretty_name" json:"pretty_name"`
- Category string `gorm:"type:varchar(255)"
mapstructure:"category" json:"category"`
- Status string `gorm:"type:varchar(255)"
mapstructure:"status" json:"status"`
- Description string `mapstructure:"description"
json:"description"`
- BeginDate *helper.CSTTime `mapstructure:"begin_date"
json:"begin_date"`
- EndDate *helper.CSTTime `mapstructure:"end_date"
json:"end_date"`
- ExternalOn string `gorm:"type:varchar(255)"
mapstructure:"external_on" json:"external_on"`
- ParentId uint64 `gorm:"type:BIGINT"
mapstructure:"parent_id,string" json:"parent_id"`
- Creator string `gorm:"type:varchar(255)"
mapstructure:"creator" json:"creator"`
- Created *helper.CSTTime `mapstructure:"created"
json:"created"`
- TransformationRuleId uint64
`mapstructure:"transformationRuleId,omitempty"
json:"transformationRuleId,omitempty"`
- common.NoPKModel `json:"-" mapstructure:"-"`
+ ConnectionId uint64 `gorm:"primaryKey;type:BIGINT NOT
NULL" mapstructure:"connection_id" json:"connection_id"`
+ Id uint64 `gorm:"primaryKey;type:BIGINT"
mapstructure:"id" json:"id"`
+ Name string `gorm:"type:varchar(255)"
mapstructure:"name" json:"name"`
+ PrettyName string `gorm:"type:varchar(255)"
mapstructure:"pretty_name" json:"pretty_name"`
+ Category string `gorm:"type:varchar(255)"
mapstructure:"category" json:"category"`
+ Status string `gorm:"type:varchar(255)"
mapstructure:"status" json:"status"`
+ Description string `mapstructure:"description"
json:"description"`
+ BeginDate *helper.CSTTime `mapstructure:"begin_date"
json:"begin_date"`
+ EndDate *helper.CSTTime `mapstructure:"end_date"
json:"end_date"`
+ ExternalOn string `gorm:"type:varchar(255)"
mapstructure:"external_on" json:"external_on"`
+ ParentId uint64 `gorm:"type:BIGINT"
mapstructure:"parent_id,string" json:"parent_id"`
+ Creator string `gorm:"type:varchar(255)"
mapstructure:"creator" json:"creator"`
+ Created *helper.CSTTime `mapstructure:"created" json:"created"`
+ ScopeConfigId uint64
`mapstructure:"scopeConfigId,omitempty" json:"scopeConfigId,omitempty"`
+ common.NoPKModel `json:"-" mapstructure:"-"`
}
func (TapdWorkspace) TableName() string {
diff --git a/backend/plugins/tapd/tasks/shared.go
b/backend/plugins/tapd/tasks/shared.go
index da88880da..e0243b63e 100644
--- a/backend/plugins/tapd/tasks/shared.go
+++ b/backend/plugins/tapd/tasks/shared.go
@@ -20,6 +20,13 @@ package tasks
import (
"encoding/json"
"fmt"
+ "io"
+ "net/http"
+ "net/url"
+ "reflect"
+ "strconv"
+ "strings"
+
"github.com/apache/incubator-devlake/core/dal"
"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/core/models/domainlayer/didgen"
@@ -27,12 +34,6 @@ import (
"github.com/apache/incubator-devlake/core/plugin"
"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
"github.com/apache/incubator-devlake/plugins/tapd/models"
- "io"
- "net/http"
- "net/url"
- "reflect"
- "strconv"
- "strings"
)
type Page struct {
@@ -206,10 +207,10 @@ func getTapdTypeMappings(data *TapdTaskData, db dal.Dal,
system string) (map[uin
// It returns the created map.
func getStdTypeMappings(data *TapdTaskData) map[string]string {
stdTypeMappings := make(map[string]string)
- if data.Options.TransformationRules == nil {
+ if data.Options.ScopeConfig == nil {
return stdTypeMappings
}
- mapping := data.Options.TransformationRules.TypeMappings
+ mapping := data.Options.ScopeConfig.TypeMappings
// Map user types to standard types
for userType, stdType := range mapping {
stdTypeMappings[userType] = strings.ToUpper(stdType)
@@ -221,10 +222,10 @@ func getStdTypeMappings(data *TapdTaskData)
map[string]string {
// based on the provided TapdTaskData. It returns the created map.
func getStatusMapping(data *TapdTaskData) map[string]string {
stdStatusMappings := make(map[string]string)
- if data.Options.TransformationRules == nil {
+ if data.Options.ScopeConfig == nil {
return stdStatusMappings
}
- mapping := data.Options.TransformationRules.StatusMappings
+ mapping := data.Options.ScopeConfig.StatusMappings
// Map original status values to standard status values
for userStatus, stdStatus := range mapping {
stdStatusMappings[userStatus] = strings.ToUpper(stdStatus)
diff --git a/backend/plugins/tapd/tasks/task_data.go
b/backend/plugins/tapd/tasks/task_data.go
index f2b3c84fd..e6bf6826d 100644
--- a/backend/plugins/tapd/tasks/task_data.go
+++ b/backend/plugins/tapd/tasks/task_data.go
@@ -27,16 +27,16 @@ import (
)
type TapdOptions struct {
- ConnectionId uint64 `mapstruct:"connectionId"`
- WorkspaceId uint64 `mapstruct:"workspaceId"`
- PageSize uint64 `mapstruct:"pageSize"`
- TimeAfter string `json:"timeAfter"
mapstructure:"timeAfter,omitempty"`
- CstZone *time.Location
- TransformationRuleId uint64
- TransformationRules *TransformationRules `json:"transformationRules"`
+ ConnectionId uint64 `mapstruct:"connectionId"`
+ WorkspaceId uint64 `mapstruct:"workspaceId"`
+ PageSize uint64 `mapstruct:"pageSize"`
+ TimeAfter string `json:"timeAfter"
mapstructure:"timeAfter,omitempty"`
+ CstZone *time.Location
+ ScopeConfigId uint64
+ ScopeConfig *TapdScopeConfig `json:"scopeConfigs"`
}
-func MakeTransformationRules(rule models.TapdTransformationRule)
(*TransformationRules, errors.Error) {
+func MakeScopeConfigs(rule models.TapdScopeConfig) (*TapdScopeConfig,
errors.Error) {
var statusMapping StatusMappings
var typeMapping TypeMappings
var err error
@@ -52,7 +52,7 @@ func MakeTransformationRules(rule
models.TapdTransformationRule) (*Transformatio
return nil, errors.Default.Wrap(err, "unable to
unmarshal the statusMapping")
}
}
- result := &TransformationRules{
+ result := &TapdScopeConfig{
StatusMappings: statusMapping,
TypeMappings: typeMapping,
}
@@ -102,7 +102,7 @@ type StatusMappings map[string]string
type TypeMappings map[string]string
-type TransformationRules struct {
+type TapdScopeConfig struct {
TypeMappings TypeMappings `json:"typeMappings"`
StatusMappings StatusMappings `json:"statusMappings"`
}