This is an automated email from the ASF dual-hosted git repository.
warren 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 ef3f09e2 feat(tapd): add story category
ef3f09e2 is described below
commit ef3f09e26baa93288f30e88d74a41e59b579cbf2
Author: Yingchu Chen <[email protected]>
AuthorDate: Wed May 25 21:25:39 2022 +0800
feat(tapd): add story category
closes #2010
---
plugins/tapd/models/bug_custom_field.go | 12 +--
.../migrationscripts/archived/bug_custom_field.go | 12 +--
.../migrationscripts/archived/story_category.go | 21 +++++
.../archived/story_custom_field.go | 12 +--
.../migrationscripts/archived/task_custom_field.go | 12 +--
.../tapd/models/migrationscripts/init_schema.go | 1 +
plugins/tapd/models/story_category.go | 21 +++++
plugins/tapd/models/story_custom_field.go | 12 +--
plugins/tapd/models/task_custom_field.go | 12 +--
plugins/tapd/tapd.go | 94 +++++++++++-----------
plugins/tapd/tasks/bug_changelog_extractor.go | 4 +-
plugins/tapd/tasks/bug_custom_fields_collector.go | 2 +-
plugins/tapd/tasks/bug_custom_fields_extractor.go | 7 +-
plugins/tapd/tasks/bug_extractor.go | 4 +-
plugins/tapd/tasks/bug_status_extractor.go | 3 +-
plugins/tapd/tasks/company_collector.go | 2 +-
plugins/tapd/tasks/company_extractor.go | 3 +-
plugins/tapd/tasks/iteration_extractor.go | 4 +-
plugins/tapd/tasks/iteration_issue_enricher.go | 39 ---------
...ds_collector.go => story_category_collector.go} | 26 +++---
...ds_extractor.go => story_category_extractor.go} | 23 +++---
plugins/tapd/tasks/story_changelog_extractor.go | 3 +-
.../tapd/tasks/story_custom_fields_collector.go | 2 +-
.../tapd/tasks/story_custom_fields_extractor.go | 7 +-
plugins/tapd/tasks/story_extractor.go | 4 +-
plugins/tapd/tasks/story_status_extractor.go | 7 +-
plugins/tapd/tasks/task_changelog_extractor.go | 3 +-
plugins/tapd/tasks/task_custom_fields_collector.go | 2 +-
plugins/tapd/tasks/task_custom_fields_extractor.go | 7 +-
plugins/tapd/tasks/task_extractor.go | 4 +-
plugins/tapd/tasks/user_extractor.go | 3 +-
plugins/tapd/tasks/worklog_extractor.go | 4 +-
plugins/tapd/tasks/workspace_extractor.go | 3 +-
33 files changed, 185 insertions(+), 190 deletions(-)
diff --git a/plugins/tapd/models/bug_custom_field.go
b/plugins/tapd/models/bug_custom_field.go
index c2c5bbd9..d8826701 100644
--- a/plugins/tapd/models/bug_custom_field.go
+++ b/plugins/tapd/models/bug_custom_field.go
@@ -6,13 +6,13 @@ type TapdBugCustomFields struct {
ConnectionId uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"`
ID uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"
json:"id,string"`
WorkspaceID uint64 `json:"workspace_id,string"`
- EntryType string `json:"entry_type"`
- CustomField string `json:"custom_field"`
- Type string `json:"type"`
- Name string `json:"name"`
+ EntryType string `json:"entry_type" gorm:"type:varchar(255)"`
+ CustomField string `json:"custom_field" gorm:"type:varchar(255)"`
+ Type string `json:"type" gorm:"type:varchar(255)"`
+ Name string `json:"name" gorm:"type:varchar(255)"`
Options string `json:"options"`
- Enabled string `json:"enabled"`
- Sort string `json:"sort"`
+ Enabled string `json:"enabled" gorm:"type:varchar(255)"`
+ Sort string `json:"sort" gorm:"type:varchar(255)"`
common.NoPKModel
}
diff --git a/plugins/tapd/models/migrationscripts/archived/bug_custom_field.go
b/plugins/tapd/models/migrationscripts/archived/bug_custom_field.go
index 41681c2d..36a06c35 100644
--- a/plugins/tapd/models/migrationscripts/archived/bug_custom_field.go
+++ b/plugins/tapd/models/migrationscripts/archived/bug_custom_field.go
@@ -6,13 +6,13 @@ type TapdBugCustomFields struct {
ConnectionId uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"`
ID uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"
json:"id,string"`
WorkspaceID uint64 `json:"workspace_id,string"`
- EntryType string `json:"entry_type"`
- CustomField string `json:"custom_field"`
- Type string `json:"type"`
- Name string `json:"name"`
+ EntryType string `json:"entry_type" gorm:"type:varchar(255)"`
+ CustomField string `json:"custom_field" gorm:"type:varchar(255)"`
+ Type string `json:"type" gorm:"type:varchar(255)"`
+ Name string `json:"name" gorm:"type:varchar(255)"`
Options string `json:"options"`
- Enabled string `json:"enabled"`
- Sort string `json:"sort"`
+ Enabled string `json:"enabled" gorm:"type:varchar(255)"`
+ Sort string `json:"sort" gorm:"type:varchar(255)"`
common.NoPKModel
}
diff --git a/plugins/tapd/models/migrationscripts/archived/story_category.go
b/plugins/tapd/models/migrationscripts/archived/story_category.go
new file mode 100644
index 00000000..b9267fac
--- /dev/null
+++ b/plugins/tapd/models/migrationscripts/archived/story_category.go
@@ -0,0 +1,21 @@
+package archived
+
+import (
+ "github.com/apache/incubator-devlake/models/common"
+ "github.com/apache/incubator-devlake/plugins/helper"
+)
+
+type TapdStoryCategory struct {
+ ConnectionId uint64 `gorm:"primaryKey"`
+ ID uint64 `gorm:"primaryKey;type:BIGINT"
json:"id,string"`
+ Name string `json:"name" gorm:"type:varchar(255)"`
+ Description string `json:"description"`
+ ParentID uint64 `json:"parent_id,string"`
+ Created *helper.CSTTime `json:"created"`
+ Modified *helper.CSTTime `json:"modified"`
+ common.NoPKModel
+}
+
+func (TapdStoryCategory) TableName() string {
+ return "_tool_tapd_story_categories"
+}
diff --git
a/plugins/tapd/models/migrationscripts/archived/story_custom_field.go
b/plugins/tapd/models/migrationscripts/archived/story_custom_field.go
index e10b3943..312f87ce 100644
--- a/plugins/tapd/models/migrationscripts/archived/story_custom_field.go
+++ b/plugins/tapd/models/migrationscripts/archived/story_custom_field.go
@@ -6,13 +6,13 @@ type TapdStoryCustomFields struct {
ConnectionId uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"`
ID uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"
json:"id,string"`
WorkspaceID uint64 `json:"workspace_id,string"`
- EntryType string `json:"entry_type"`
- CustomField string `json:"custom_field"`
- Type string `json:"type"`
- Name string `json:"name"`
+ EntryType string `json:"entry_type" gorm:"type:varchar(255)"`
+ CustomField string `json:"custom_field" gorm:"type:varchar(255)"`
+ Type string `json:"type" gorm:"type:varchar(255)"`
+ Name string `json:"name" gorm:"type:varchar(255)"`
Options string `json:"options"`
- Enabled string `json:"enabled"`
- Sort string `json:"sort"`
+ Enabled string `json:"enabled" gorm:"type:varchar(255)"`
+ Sort string `json:"sort" gorm:"type:varchar(255)"`
common.NoPKModel
}
diff --git a/plugins/tapd/models/migrationscripts/archived/task_custom_field.go
b/plugins/tapd/models/migrationscripts/archived/task_custom_field.go
index 6350bc84..b069c8fa 100644
--- a/plugins/tapd/models/migrationscripts/archived/task_custom_field.go
+++ b/plugins/tapd/models/migrationscripts/archived/task_custom_field.go
@@ -6,13 +6,13 @@ type TapdTaskCustomFields struct {
ConnectionId uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"`
ID uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"
json:"id,string"`
WorkspaceID uint64 `json:"workspace_id,string"`
- EntryType string `json:"entry_type"`
- CustomField string `json:"custom_field"`
- Type string `json:"type"`
- Name string `json:"name"`
+ EntryType string `json:"entry_type" gorm:"type:varchar(255)"`
+ CustomField string `json:"custom_field" gorm:"type:varchar(255)"`
+ Type string `json:"type" gorm:"type:varchar(255)"`
+ Name string `json:"name" gorm:"type:varchar(255)"`
Options string `json:"options"`
- Enabled string `json:"enabled"`
- Sort string `json:"sort"`
+ Enabled string `json:"enabled" gorm:"type:varchar(255)"`
+ Sort string `json:"sort" gorm:"type:varchar(255)"`
common.NoPKModel
}
diff --git a/plugins/tapd/models/migrationscripts/init_schema.go
b/plugins/tapd/models/migrationscripts/init_schema.go
index 65bf881b..7a33a2fc 100644
--- a/plugins/tapd/models/migrationscripts/init_schema.go
+++ b/plugins/tapd/models/migrationscripts/init_schema.go
@@ -60,6 +60,7 @@ func (*InitSchemas) Up(ctx context.Context, db *gorm.DB)
error {
&archived.TapdStoryCustomFields{},
&archived.TapdBugCustomFields{},
&archived.TapdTaskCustomFields{},
+ &archived.TapdStoryCategory{},
)
}
diff --git a/plugins/tapd/models/story_category.go
b/plugins/tapd/models/story_category.go
new file mode 100644
index 00000000..5f5cd5c7
--- /dev/null
+++ b/plugins/tapd/models/story_category.go
@@ -0,0 +1,21 @@
+package models
+
+import (
+ "github.com/apache/incubator-devlake/models/common"
+ "github.com/apache/incubator-devlake/plugins/helper"
+)
+
+type TapdStoryCategory struct {
+ ConnectionId uint64 `gorm:"primaryKey"`
+ ID uint64 `gorm:"primaryKey;type:BIGINT"
json:"id,string"`
+ Name string `json:"name" gorm:"type:varchar(255)"`
+ Description string `json:"description"`
+ ParentID uint64 `json:"parent_id,string"`
+ Created *helper.CSTTime `json:"created"`
+ Modified *helper.CSTTime `json:"modified"`
+ common.NoPKModel
+}
+
+func (TapdStoryCategory) TableName() string {
+ return "_tool_tapd_story_categories"
+}
diff --git a/plugins/tapd/models/story_custom_field.go
b/plugins/tapd/models/story_custom_field.go
index 02cbe9c5..e6b05082 100644
--- a/plugins/tapd/models/story_custom_field.go
+++ b/plugins/tapd/models/story_custom_field.go
@@ -6,13 +6,13 @@ type TapdStoryCustomFields struct {
ConnectionId uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"`
ID uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"
json:"id,string"`
WorkspaceID uint64 `json:"workspace_id,string"`
- EntryType string `json:"entry_type"`
- CustomField string `json:"custom_field"`
- Type string `json:"type"`
- Name string `json:"name"`
+ EntryType string `json:"entry_type" gorm:"type:varchar(255)"`
+ CustomField string `json:"custom_field" gorm:"type:varchar(255)"`
+ Type string `json:"type" gorm:"type:varchar(255)"`
+ Name string `json:"name" gorm:"type:varchar(255)"`
Options string `json:"options"`
- Enabled string `json:"enabled"`
- Sort string `json:"sort"`
+ Enabled string `json:"enabled" gorm:"type:varchar(255)"`
+ Sort string `json:"sort" gorm:"type:varchar(255)"`
common.NoPKModel
}
diff --git a/plugins/tapd/models/task_custom_field.go
b/plugins/tapd/models/task_custom_field.go
index 4b4bf81b..326f3ec5 100644
--- a/plugins/tapd/models/task_custom_field.go
+++ b/plugins/tapd/models/task_custom_field.go
@@ -6,13 +6,13 @@ type TapdTaskCustomFields struct {
ConnectionId uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"`
ID uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"
json:"id,string"`
WorkspaceID uint64 `json:"workspace_id,string"`
- EntryType string `json:"entry_type"`
- CustomField string `json:"custom_field"`
- Type string `json:"type"`
- Name string `json:"name"`
+ EntryType string `json:"entry_type" gorm:"type:varchar(255)"`
+ CustomField string `json:"custom_field" gorm:"type:varchar(255)"`
+ Type string `json:"type" gorm:"type:varchar(255)"`
+ Name string `json:"name" gorm:"type:varchar(255)"`
Options string `json:"options"`
- Enabled string `json:"enabled"`
- Sort string `json:"sort"`
+ Enabled string `json:"enabled" gorm:"type:varchar(255)"`
+ Sort string `json:"sort" gorm:"type:varchar(255)"`
common.NoPKModel
}
diff --git a/plugins/tapd/tapd.go b/plugins/tapd/tapd.go
index 9fdc24b5..81b28806 100644
--- a/plugins/tapd/tapd.go
+++ b/plugins/tapd/tapd.go
@@ -54,58 +54,60 @@ func (plugin Tapd) Description() string {
func (plugin Tapd) SubTaskMetas() []core.SubTaskMeta {
return []core.SubTaskMeta{
- //tasks.CollectCompanyMeta,
- //tasks.ExtractCompanyMeta,
- //tasks.CollectWorkspaceMeta,
- //tasks.ExtractWorkspaceMeta,
+ tasks.CollectCompanyMeta,
+ tasks.ExtractCompanyMeta,
+ tasks.CollectWorkspaceMeta,
+ tasks.ExtractWorkspaceMeta,
tasks.CollectStoryCustomFieldsMeta,
tasks.ExtractStoryCustomFieldsMeta,
tasks.CollectTaskCustomFieldsMeta,
tasks.ExtractTaskCustomFieldsMeta,
tasks.CollectBugCustomFieldsMeta,
tasks.ExtractBugCustomFieldsMeta,
- //tasks.CollectBugStatusMeta,
- //tasks.ExtractBugStatusMeta,
- //tasks.CollectUserMeta,
- //tasks.ExtractUserMeta,
- //tasks.CollectIterationMeta,
- //tasks.ExtractIterationMeta,
- //tasks.CollectStoryMeta,
- //tasks.CollectBugMeta,
- //tasks.CollectTaskMeta,
- //tasks.ExtractStoryMeta,
- //tasks.ExtractBugMeta,
- //tasks.ExtractTaskMeta,
- //tasks.CollectBugChangelogMeta,
- //tasks.ExtractBugChangelogMeta,
- //tasks.CollectStoryChangelogMeta,
- //tasks.ExtractStoryChangelogMeta,
- //tasks.CollectTaskChangelogMeta,
- //tasks.ExtractTaskChangelogMeta,
- //tasks.CollectWorklogMeta,
- //tasks.ExtractWorklogMeta,
- //tasks.CollectBugCommitMeta,
- //tasks.ExtractBugCommitMeta,
- //tasks.CollectStoryCommitMeta,
- //tasks.ExtractStoryCommitMeta,
- //tasks.CollectTaskCommitMeta,
- //tasks.ExtractTaskCommitMeta,
- //tasks.ConvertWorkspaceMeta,
- //tasks.ConvertUserMeta,
- //tasks.ConvertIterationMeta,
- //tasks.ConvertStoryMeta,
- //tasks.ConvertBugMeta,
- //tasks.ConvertTaskMeta,
- //tasks.ConvertWorklogMeta,
- //tasks.ConvertBugChangelogMeta,
- //tasks.ConvertStoryChangelogMeta,
- //tasks.ConvertTaskChangelogMeta,
- //tasks.ConvertBugCommitMeta,
- //tasks.ConvertStoryCommitMeta,
- //tasks.ConvertTaskCommitMeta,
- //tasks.ConvertStoryLabelsMeta,
- //tasks.ConvertTaskLabelsMeta,
- //tasks.ConvertBugLabelsMeta,
+ tasks.CollectStoryCategoriesMeta,
+ tasks.ExtractStoryCategoriesMeta,
+ tasks.CollectBugStatusMeta,
+ tasks.ExtractBugStatusMeta,
+ tasks.CollectUserMeta,
+ tasks.ExtractUserMeta,
+ tasks.CollectIterationMeta,
+ tasks.ExtractIterationMeta,
+ tasks.CollectStoryMeta,
+ tasks.CollectBugMeta,
+ tasks.CollectTaskMeta,
+ tasks.ExtractStoryMeta,
+ tasks.ExtractBugMeta,
+ tasks.ExtractTaskMeta,
+ tasks.CollectBugChangelogMeta,
+ tasks.ExtractBugChangelogMeta,
+ tasks.CollectStoryChangelogMeta,
+ tasks.ExtractStoryChangelogMeta,
+ tasks.CollectTaskChangelogMeta,
+ tasks.ExtractTaskChangelogMeta,
+ tasks.CollectWorklogMeta,
+ tasks.ExtractWorklogMeta,
+ tasks.CollectBugCommitMeta,
+ tasks.ExtractBugCommitMeta,
+ tasks.CollectStoryCommitMeta,
+ tasks.ExtractStoryCommitMeta,
+ tasks.CollectTaskCommitMeta,
+ tasks.ExtractTaskCommitMeta,
+ tasks.ConvertWorkspaceMeta,
+ tasks.ConvertUserMeta,
+ tasks.ConvertIterationMeta,
+ tasks.ConvertStoryMeta,
+ tasks.ConvertBugMeta,
+ tasks.ConvertTaskMeta,
+ tasks.ConvertWorklogMeta,
+ tasks.ConvertBugChangelogMeta,
+ tasks.ConvertStoryChangelogMeta,
+ tasks.ConvertTaskChangelogMeta,
+ tasks.ConvertBugCommitMeta,
+ tasks.ConvertStoryCommitMeta,
+ tasks.ConvertTaskCommitMeta,
+ tasks.ConvertStoryLabelsMeta,
+ tasks.ConvertTaskLabelsMeta,
+ tasks.ConvertBugLabelsMeta,
}
}
diff --git a/plugins/tapd/tasks/bug_changelog_extractor.go
b/plugins/tapd/tasks/bug_changelog_extractor.go
index af38c212..3616eede 100644
--- a/plugins/tapd/tasks/bug_changelog_extractor.go
+++ b/plugins/tapd/tasks/bug_changelog_extractor.go
@@ -33,7 +33,7 @@ var ExtractBugChangelogMeta = core.SubTaskMeta{
Description: "Extract raw workspace data into tool layer table
_tool_tapd_bug_changelogs",
}
-type TapdBugChangelogRes struct {
+var bugChangelogBody struct {
BugChange models.TapdBugChangelog
}
@@ -51,7 +51,7 @@ func ExtractBugChangelog(taskCtx core.SubTaskContext) error {
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
results := make([]interface{}, 0, 2)
- var bugChangelogBody TapdBugChangelogRes
+
err := json.Unmarshal(row.Data, &bugChangelogBody)
if err != nil {
return nil, err
diff --git a/plugins/tapd/tasks/bug_custom_fields_collector.go
b/plugins/tapd/tasks/bug_custom_fields_collector.go
index c3347b6a..64bf4575 100644
--- a/plugins/tapd/tasks/bug_custom_fields_collector.go
+++ b/plugins/tapd/tasks/bug_custom_fields_collector.go
@@ -26,7 +26,7 @@ import (
"net/url"
)
-const RAW_BUG_CUSTOM_FIELDS_TABLE = "tapd_api_bug_bug_custom_fields"
+const RAW_BUG_CUSTOM_FIELDS_TABLE = "tapd_api_bug_custom_fields"
var _ core.SubTaskEntryPoint = CollectBugCustomFields
diff --git a/plugins/tapd/tasks/bug_custom_fields_extractor.go
b/plugins/tapd/tasks/bug_custom_fields_extractor.go
index c4f01950..b85891e2 100644
--- a/plugins/tapd/tasks/bug_custom_fields_extractor.go
+++ b/plugins/tapd/tasks/bug_custom_fields_extractor.go
@@ -33,7 +33,7 @@ var ExtractBugCustomFieldsMeta = core.SubTaskMeta{
Description: "Extract raw company data into tool layer table
_tool_tapd_bug_custom_fields",
}
-type TapdBugCustomFieldsRes struct {
+var bugCustomFields struct {
CustomFieldConfig models.TapdBugCustomFields
}
@@ -49,13 +49,12 @@ func ExtractBugCustomFields(taskCtx core.SubTaskContext)
error {
Table: RAW_BUG_CUSTOM_FIELDS_TABLE,
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
- var customFields TapdBugCustomFieldsRes
- err := json.Unmarshal(row.Data, &customFields)
+ err := json.Unmarshal(row.Data, &bugCustomFields)
if err != nil {
return nil, err
}
- toolL := customFields.CustomFieldConfig
+ toolL := bugCustomFields.CustomFieldConfig
toolL.ConnectionId = data.Connection.ID
return []interface{}{
diff --git a/plugins/tapd/tasks/bug_extractor.go
b/plugins/tapd/tasks/bug_extractor.go
index b4acd406..976af630 100644
--- a/plugins/tapd/tasks/bug_extractor.go
+++ b/plugins/tapd/tasks/bug_extractor.go
@@ -36,7 +36,7 @@ var ExtractBugMeta = core.SubTaskMeta{
Description: "Extract raw workspace data into tool layer table
_tool_tapd_iterations",
}
-type TapdBugRes struct {
+var bugBody struct {
Bug models.TapdBug
}
@@ -77,7 +77,7 @@ func ExtractBugs(taskCtx core.SubTaskContext) error {
Table: RAW_BUG_TABLE,
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
- var bugBody TapdBugRes
+
err := json.Unmarshal(row.Data, &bugBody)
if err != nil {
return nil, err
diff --git a/plugins/tapd/tasks/bug_status_extractor.go
b/plugins/tapd/tasks/bug_status_extractor.go
index 8f16d130..7ae11fa1 100644
--- a/plugins/tapd/tasks/bug_status_extractor.go
+++ b/plugins/tapd/tasks/bug_status_extractor.go
@@ -33,7 +33,7 @@ var ExtractBugStatusMeta = core.SubTaskMeta{
Description: "Extract raw workspace data into tool layer table
_tool_tapd_bugStatus",
}
-type TapdBugStatusRes struct {
+var statusRes struct {
Data map[string]string
}
@@ -50,7 +50,6 @@ func ExtractBugStatus(taskCtx core.SubTaskContext) error {
Table: RAW_BUG_STATUS_TABLE,
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
- var statusRes TapdBugStatusRes
err := json.Unmarshal(row.Data, &statusRes)
if err != nil {
return nil, err
diff --git a/plugins/tapd/tasks/company_collector.go
b/plugins/tapd/tasks/company_collector.go
index 49678fb4..e2bf63a8 100644
--- a/plugins/tapd/tasks/company_collector.go
+++ b/plugins/tapd/tasks/company_collector.go
@@ -71,6 +71,6 @@ func CollectCompanies(taskCtx core.SubTaskContext) error {
var CollectCompanyMeta = core.SubTaskMeta{
Name: "collectCompanies",
EntryPoint: CollectCompanies,
- Required: true,
+ Required: false,
Description: "collect Tapd companies",
}
diff --git a/plugins/tapd/tasks/company_extractor.go
b/plugins/tapd/tasks/company_extractor.go
index 4dd5eee7..0894276f 100644
--- a/plugins/tapd/tasks/company_extractor.go
+++ b/plugins/tapd/tasks/company_extractor.go
@@ -28,7 +28,7 @@ var _ core.SubTaskEntryPoint = ExtractCompanies
var ExtractCompanyMeta = core.SubTaskMeta{
Name: "extractCompanies",
EntryPoint: ExtractCompanies,
- EnabledByDefault: true,
+ EnabledByDefault: false,
Description: "Extract raw company data into tool layer table
_tool_tapd_workspaces",
}
@@ -44,7 +44,6 @@ func ExtractCompanies(taskCtx core.SubTaskContext) error {
Table: RAW_COMPANY_TABLE,
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
- var workspaceRes TapdWorkspaceRes
err := json.Unmarshal(row.Data, &workspaceRes)
if err != nil {
return nil, err
diff --git a/plugins/tapd/tasks/iteration_extractor.go
b/plugins/tapd/tasks/iteration_extractor.go
index e35c7523..ffb3f260 100644
--- a/plugins/tapd/tasks/iteration_extractor.go
+++ b/plugins/tapd/tasks/iteration_extractor.go
@@ -33,7 +33,7 @@ var ExtractIterationMeta = core.SubTaskMeta{
Description: "Extract raw workspace data into tool layer table
_tool_tapd_iterations",
}
-type TapdIterationRes struct {
+var iterBody struct {
Iteration models.TapdIteration
}
@@ -50,7 +50,7 @@ func ExtractIterations(taskCtx core.SubTaskContext) error {
Table: RAW_ITERATION_TABLE,
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
- var iterBody TapdIterationRes
+
err := json.Unmarshal(row.Data, &iterBody)
if err != nil {
return nil, err
diff --git a/plugins/tapd/tasks/iteration_issue_enricher.go
b/plugins/tapd/tasks/iteration_issue_enricher.go
deleted file mode 100644
index f286f1c1..00000000
--- a/plugins/tapd/tasks/iteration_issue_enricher.go
+++ /dev/null
@@ -1,39 +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 tasks
-
-//import (
-// "github.com/apache/incubator-devlake/models/domainlayer/ticket"
-// "time"
-//)
-//
-//func getStage(t time.Time, sprintStart, sprintComplete *time.Time) *string {
-// if sprintStart == nil {
-// return &ticket.BeforeSprint
-// }
-// if sprintStart.After(t) {
-// return &ticket.BeforeSprint
-// }
-// if sprintComplete == nil {
-// return &ticket.DuringSprint
-// }
-// if sprintComplete.Before(t) {
-// return &ticket.AfterSprint
-// }
-// return &ticket.DuringSprint
-//}
diff --git a/plugins/tapd/tasks/bug_custom_fields_collector.go
b/plugins/tapd/tasks/story_category_collector.go
similarity index 73%
copy from plugins/tapd/tasks/bug_custom_fields_collector.go
copy to plugins/tapd/tasks/story_category_collector.go
index c3347b6a..4632bd83 100644
--- a/plugins/tapd/tasks/bug_custom_fields_collector.go
+++ b/plugins/tapd/tasks/story_category_collector.go
@@ -26,14 +26,14 @@ import (
"net/url"
)
-const RAW_BUG_CUSTOM_FIELDS_TABLE = "tapd_api_bug_bug_custom_fields"
+const RAW_STORY_CATEGORY_TABLE = "tapd_api_story_categories"
-var _ core.SubTaskEntryPoint = CollectBugCustomFields
+var _ core.SubTaskEntryPoint = CollectStoryCategories
-func CollectBugCustomFields(taskCtx core.SubTaskContext) error {
+func CollectStoryCategories(taskCtx core.SubTaskContext) error {
data := taskCtx.GetData().(*TapdTaskData)
logger := taskCtx.GetLogger()
- logger.Info("collect bug_custom_fields")
+ logger.Info("collect story_category")
collector, err := helper.NewApiCollector(helper.ApiCollectorArgs{
RawDataSubTaskArgs: helper.RawDataSubTaskArgs{
Ctx: taskCtx,
@@ -41,11 +41,11 @@ func CollectBugCustomFields(taskCtx core.SubTaskContext)
error {
ConnectionId: data.Connection.ID,
WorkspaceID: data.Options.WorkspaceID,
},
- Table: RAW_BUG_CUSTOM_FIELDS_TABLE,
+ Table: RAW_STORY_CATEGORY_TABLE,
},
ApiClient: data.ApiClient,
//PageSize: 100,
- UrlTemplate: "bugs/custom_fields_settings",
+ UrlTemplate: "story_categories",
Query: func(reqData *helper.RequestData) (url.Values, error) {
query := url.Values{}
query.Set("workspace_id", fmt.Sprintf("%v",
data.Options.WorkspaceID))
@@ -53,22 +53,22 @@ func CollectBugCustomFields(taskCtx core.SubTaskContext)
error {
},
ResponseParser: func(res *http.Response) ([]json.RawMessage,
error) {
var data struct {
- BugCustomFields []json.RawMessage `json:"data"`
+ StoryCategories []json.RawMessage `json:"data"`
}
err := helper.UnmarshalResponse(res, &data)
- return data.BugCustomFields, err
+ return data.StoryCategories, err
},
})
if err != nil {
- logger.Error("collect bug_custom_fields error:", err)
+ logger.Error("collect story_category error:", err)
return err
}
return collector.Execute()
}
-var CollectBugCustomFieldsMeta = core.SubTaskMeta{
- Name: "collectBugCustomFields",
- EntryPoint: CollectBugCustomFields,
+var CollectStoryCategoriesMeta = core.SubTaskMeta{
+ Name: "collectStoryCategories",
+ EntryPoint: CollectStoryCategories,
Required: true,
- Description: "collect Tapd BugCustomFields",
+ Description: "collect Tapd StoryCategories",
}
diff --git a/plugins/tapd/tasks/bug_custom_fields_extractor.go
b/plugins/tapd/tasks/story_category_extractor.go
similarity index 74%
copy from plugins/tapd/tasks/bug_custom_fields_extractor.go
copy to plugins/tapd/tasks/story_category_extractor.go
index c4f01950..bc960181 100644
--- a/plugins/tapd/tasks/bug_custom_fields_extractor.go
+++ b/plugins/tapd/tasks/story_category_extractor.go
@@ -24,20 +24,20 @@ import (
"github.com/apache/incubator-devlake/plugins/tapd/models"
)
-var _ core.SubTaskEntryPoint = ExtractBugCustomFields
+var _ core.SubTaskEntryPoint = ExtractStoryCategories
-var ExtractBugCustomFieldsMeta = core.SubTaskMeta{
- Name: "extractBugCustomFields",
- EntryPoint: ExtractBugCustomFields,
+var ExtractStoryCategoriesMeta = core.SubTaskMeta{
+ Name: "extractStoryCategories",
+ EntryPoint: ExtractStoryCategories,
EnabledByDefault: true,
- Description: "Extract raw company data into tool layer table
_tool_tapd_bug_custom_fields",
+ Description: "Extract raw company data into tool layer table
_tool_tapd_story_category",
}
-type TapdBugCustomFieldsRes struct {
- CustomFieldConfig models.TapdBugCustomFields
+var storyCategory struct {
+ Category models.TapdStoryCategory
}
-func ExtractBugCustomFields(taskCtx core.SubTaskContext) error {
+func ExtractStoryCategories(taskCtx core.SubTaskContext) error {
data := taskCtx.GetData().(*TapdTaskData)
extractor, err := helper.NewApiExtractor(helper.ApiExtractorArgs{
RawDataSubTaskArgs: helper.RawDataSubTaskArgs{
@@ -46,16 +46,15 @@ func ExtractBugCustomFields(taskCtx core.SubTaskContext)
error {
ConnectionId: data.Connection.ID,
WorkspaceID: data.Options.WorkspaceID,
},
- Table: RAW_BUG_CUSTOM_FIELDS_TABLE,
+ Table: RAW_STORY_CATEGORY_TABLE,
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
- var customFields TapdBugCustomFieldsRes
- err := json.Unmarshal(row.Data, &customFields)
+ err := json.Unmarshal(row.Data, &storyCategory)
if err != nil {
return nil, err
}
- toolL := customFields.CustomFieldConfig
+ toolL := storyCategory.Category
toolL.ConnectionId = data.Connection.ID
return []interface{}{
diff --git a/plugins/tapd/tasks/story_changelog_extractor.go
b/plugins/tapd/tasks/story_changelog_extractor.go
index 2abd1ae2..714037e3 100644
--- a/plugins/tapd/tasks/story_changelog_extractor.go
+++ b/plugins/tapd/tasks/story_changelog_extractor.go
@@ -34,7 +34,7 @@ var ExtractStoryChangelogMeta = core.SubTaskMeta{
Description: "Extract raw workspace data into tool layer table
_tool_tapd_iterations",
}
-type TapdStoryChangelogRes struct {
+var storyChangelogBody struct {
WorkitemChange models.TapdStoryChangelog
}
@@ -54,7 +54,6 @@ func ExtractStoryChangelog(taskCtx core.SubTaskContext) error
{
results := make([]interface{}, 0, 2)
- var storyChangelogBody TapdStoryChangelogRes
err := json.Unmarshal(row.Data, &storyChangelogBody)
if err != nil {
return nil, err
diff --git a/plugins/tapd/tasks/story_custom_fields_collector.go
b/plugins/tapd/tasks/story_custom_fields_collector.go
index 888f8991..f7f22ec1 100644
--- a/plugins/tapd/tasks/story_custom_fields_collector.go
+++ b/plugins/tapd/tasks/story_custom_fields_collector.go
@@ -26,7 +26,7 @@ import (
"net/url"
)
-const RAW_STORY_CUSTOM_FIELDS_TABLE = "tapd_api_story_story_custom_fields"
+const RAW_STORY_CUSTOM_FIELDS_TABLE = "tapd_api_story_custom_fields"
var _ core.SubTaskEntryPoint = CollectStoryCustomFields
diff --git a/plugins/tapd/tasks/story_custom_fields_extractor.go
b/plugins/tapd/tasks/story_custom_fields_extractor.go
index 6549485f..5ac714fb 100644
--- a/plugins/tapd/tasks/story_custom_fields_extractor.go
+++ b/plugins/tapd/tasks/story_custom_fields_extractor.go
@@ -33,7 +33,7 @@ var ExtractStoryCustomFieldsMeta = core.SubTaskMeta{
Description: "Extract raw company data into tool layer table
_tool_tapd_story_custom_fields",
}
-type TapdStoryCustomFieldsRes struct {
+var storyCustomFields struct {
CustomFieldConfig models.TapdStoryCustomFields
}
@@ -49,13 +49,12 @@ func ExtractStoryCustomFields(taskCtx core.SubTaskContext)
error {
Table: RAW_STORY_CUSTOM_FIELDS_TABLE,
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
- var customFields TapdStoryCustomFieldsRes
- err := json.Unmarshal(row.Data, &customFields)
+ err := json.Unmarshal(row.Data, &storyCustomFields)
if err != nil {
return nil, err
}
- toolL := customFields.CustomFieldConfig
+ toolL := storyCustomFields.CustomFieldConfig
toolL.ConnectionId = data.Connection.ID
return []interface{}{
diff --git a/plugins/tapd/tasks/story_extractor.go
b/plugins/tapd/tasks/story_extractor.go
index 82bd99c0..d69a4429 100644
--- a/plugins/tapd/tasks/story_extractor.go
+++ b/plugins/tapd/tasks/story_extractor.go
@@ -36,7 +36,7 @@ var ExtractStoryMeta = core.SubTaskMeta{
Description: "Extract raw workspace data into tool layer table
_tool_tapd_iterations",
}
-type TapdStoryRes struct {
+var storyBody struct {
Story models.TapdStory
}
@@ -75,7 +75,7 @@ func ExtractStories(taskCtx core.SubTaskContext) error {
Table: RAW_STORY_TABLE,
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
- var storyBody TapdStoryRes
+
err := json.Unmarshal(row.Data, &storyBody)
if err != nil {
return nil, err
diff --git a/plugins/tapd/tasks/story_status_extractor.go
b/plugins/tapd/tasks/story_status_extractor.go
index f07f4f51..30d91657 100644
--- a/plugins/tapd/tasks/story_status_extractor.go
+++ b/plugins/tapd/tasks/story_status_extractor.go
@@ -33,7 +33,7 @@ var ExtractStoryStatusMeta = core.SubTaskMeta{
Description: "Extract raw workspace data into tool layer table
_tool_tapd_bugStatus",
}
-type TapdStoryStatusRes struct {
+var storyStatusRes struct {
Data map[string]string
}
@@ -50,13 +50,12 @@ func ExtractStoryStatus(taskCtx core.SubTaskContext) error {
Table: RAW_STORY_STATUS_TABLE,
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
- var statusRes TapdStoryStatusRes
- err := json.Unmarshal(row.Data, &statusRes)
+ err := json.Unmarshal(row.Data, &storyStatusRes)
if err != nil {
return nil, err
}
results := make([]interface{}, 0)
- for k, v := range statusRes.Data {
+ for k, v := range storyStatusRes.Data {
toolL := &models.TapdStoryStatus{
ConnectionId: data.Connection.ID,
WorkspaceID: data.Options.WorkspaceID,
diff --git a/plugins/tapd/tasks/task_changelog_extractor.go
b/plugins/tapd/tasks/task_changelog_extractor.go
index 10980f58..a5033c6b 100644
--- a/plugins/tapd/tasks/task_changelog_extractor.go
+++ b/plugins/tapd/tasks/task_changelog_extractor.go
@@ -34,7 +34,7 @@ var ExtractTaskChangelogMeta = core.SubTaskMeta{
Description: "Extract raw workspace data into tool layer table
_tool_tapd_iterations",
}
-type TapdTaskChangelogRes struct {
+var taskChangelogBody struct {
WorkitemChange models.TapdTaskChangelog
}
@@ -54,7 +54,6 @@ func ExtractTaskChangelog(taskCtx core.SubTaskContext) error {
results := make([]interface{}, 0, 2)
- var taskChangelogBody TapdTaskChangelogRes
err := json.Unmarshal(row.Data, &taskChangelogBody)
if err != nil {
return nil, err
diff --git a/plugins/tapd/tasks/task_custom_fields_collector.go
b/plugins/tapd/tasks/task_custom_fields_collector.go
index 976375ac..4d095aef 100644
--- a/plugins/tapd/tasks/task_custom_fields_collector.go
+++ b/plugins/tapd/tasks/task_custom_fields_collector.go
@@ -26,7 +26,7 @@ import (
"net/url"
)
-const RAW_TASK_CUSTOM_FIELDS_TABLE = "tapd_api_task_task_custom_fields"
+const RAW_TASK_CUSTOM_FIELDS_TABLE = "tapd_api_task_custom_fields"
var _ core.SubTaskEntryPoint = CollectTaskCustomFields
diff --git a/plugins/tapd/tasks/task_custom_fields_extractor.go
b/plugins/tapd/tasks/task_custom_fields_extractor.go
index 46c9879a..57727949 100644
--- a/plugins/tapd/tasks/task_custom_fields_extractor.go
+++ b/plugins/tapd/tasks/task_custom_fields_extractor.go
@@ -33,7 +33,7 @@ var ExtractTaskCustomFieldsMeta = core.SubTaskMeta{
Description: "Extract raw company data into tool layer table
_tool_tapd_task_custom_fields",
}
-type TapdTaskCustomFieldsRes struct {
+var taskCustomFieldsRes struct {
CustomFieldConfig models.TapdTaskCustomFields
}
@@ -49,13 +49,12 @@ func ExtractTaskCustomFields(taskCtx core.SubTaskContext)
error {
Table: RAW_TASK_CUSTOM_FIELDS_TABLE,
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
- var customFields TapdTaskCustomFieldsRes
- err := json.Unmarshal(row.Data, &customFields)
+ err := json.Unmarshal(row.Data, &taskCustomFieldsRes)
if err != nil {
return nil, err
}
- toolL := customFields.CustomFieldConfig
+ toolL := taskCustomFieldsRes.CustomFieldConfig
toolL.ConnectionId = data.Connection.ID
return []interface{}{
diff --git a/plugins/tapd/tasks/task_extractor.go
b/plugins/tapd/tasks/task_extractor.go
index 16ffa4e1..db9b3b82 100644
--- a/plugins/tapd/tasks/task_extractor.go
+++ b/plugins/tapd/tasks/task_extractor.go
@@ -36,7 +36,7 @@ var ExtractTaskMeta = core.SubTaskMeta{
Description: "Extract raw workspace data into tool layer table
_tool_tapd_iterations",
}
-type TapdTaskRes struct {
+var taskBody struct {
Task models.TapdTask
}
@@ -62,7 +62,7 @@ func ExtractTasks(taskCtx core.SubTaskContext) error {
Table: RAW_TASK_TABLE,
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
- var taskBody TapdTaskRes
+
err := json.Unmarshal(row.Data, &taskBody)
if err != nil {
return nil, err
diff --git a/plugins/tapd/tasks/user_extractor.go
b/plugins/tapd/tasks/user_extractor.go
index 5d8e53f1..49613051 100644
--- a/plugins/tapd/tasks/user_extractor.go
+++ b/plugins/tapd/tasks/user_extractor.go
@@ -33,7 +33,7 @@ var ExtractUserMeta = core.SubTaskMeta{
Description: "Extract raw workspace data into tool layer table
_tool_tapd_users",
}
-type TapdUserRes struct {
+var userRes struct {
UserWorkspace models.TapdUser
}
@@ -50,7 +50,6 @@ func ExtractUsers(taskCtx core.SubTaskContext) error {
Table: RAW_USER_TABLE,
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
- var userRes TapdUserRes
err := json.Unmarshal(row.Data, &userRes)
if err != nil {
return nil, err
diff --git a/plugins/tapd/tasks/worklog_extractor.go
b/plugins/tapd/tasks/worklog_extractor.go
index 824c9012..1ed7f0d8 100644
--- a/plugins/tapd/tasks/worklog_extractor.go
+++ b/plugins/tapd/tasks/worklog_extractor.go
@@ -33,7 +33,7 @@ var ExtractWorklogMeta = core.SubTaskMeta{
Description: "Extract raw workspace data into tool layer table
_tool_tapd_iterations",
}
-type TapdWorklogRes struct {
+var worklogBody struct {
Timesheet models.TapdWorklog
}
@@ -50,7 +50,7 @@ func ExtractWorklogs(taskCtx core.SubTaskContext) error {
Table: RAW_WORKLOG_TABLE,
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
- var worklogBody TapdWorklogRes
+
err := json.Unmarshal(row.Data, &worklogBody)
if err != nil {
return nil, err
diff --git a/plugins/tapd/tasks/workspace_extractor.go
b/plugins/tapd/tasks/workspace_extractor.go
index 3ee758d2..576a7ae9 100644
--- a/plugins/tapd/tasks/workspace_extractor.go
+++ b/plugins/tapd/tasks/workspace_extractor.go
@@ -33,7 +33,7 @@ var ExtractWorkspaceMeta = core.SubTaskMeta{
Description: "Extract raw workspace data into tool layer table
_tool_tapd_workspaces",
}
-type TapdWorkspaceRes struct {
+var workspaceRes struct {
Workspace models.TapdWorkspace
}
@@ -50,7 +50,6 @@ func ExtractWorkspaces(taskCtx core.SubTaskContext) error {
Table: RAW_WORKSPACE_TABLE,
},
Extract: func(row *helper.RawData) ([]interface{}, error) {
- var workspaceRes TapdWorkspaceRes
err := json.Unmarshal(row.Data, &workspaceRes)
if err != nil {
return nil, err