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

zhangliang2022 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 b24e73a65 feat(domain): add issue_assignee domain table (#4841)
b24e73a65 is described below

commit b24e73a6531f7eca22bd424436220d31a2117b40
Author: Xiaojian Zheng <[email protected]>
AuthorDate: Tue May 23 19:48:10 2023 +0800

    feat(domain): add issue_assignee domain table (#4841)
---
 .../models/domainlayer/ticket/issue_assignee.go    | 32 +++++++++++++
 .../20230402_add_issue_assignee.go                 | 52 ++++++++++++++++++++++
 backend/core/models/migrationscripts/register.go   |  1 +
 .../e2e/snapshot_tables/issue_assignees.csv        | 22 +++++++++
 backend/plugins/teambition/e2e/task_test.go        |  9 ++++
 backend/plugins/teambition/tasks/task_converter.go |  7 +++
 6 files changed, 123 insertions(+)

diff --git a/backend/core/models/domainlayer/ticket/issue_assignee.go 
b/backend/core/models/domainlayer/ticket/issue_assignee.go
new file mode 100644
index 000000000..1ad9824dd
--- /dev/null
+++ b/backend/core/models/domainlayer/ticket/issue_assignee.go
@@ -0,0 +1,32 @@
+/*
+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 ticket
+
+import "github.com/apache/incubator-devlake/core/models/common"
+
+type IssueAssignee struct {
+       IssueId      string `gorm:"primaryKey;type:varchar(255)"`
+       AssigneeId   string `gorm:"primaryKey;type:varchar(255)"`
+       AssigneeName string `gorm:"type:varchar(255)"`
+
+       common.NoPKModel
+}
+
+func (IssueAssignee) TableName() string {
+       return "issue_assignees"
+}
diff --git 
a/backend/core/models/migrationscripts/20230402_add_issue_assignee.go 
b/backend/core/models/migrationscripts/20230402_add_issue_assignee.go
new file mode 100644
index 000000000..d6c8ae2d4
--- /dev/null
+++ b/backend/core/models/migrationscripts/20230402_add_issue_assignee.go
@@ -0,0 +1,52 @@
+/*
+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/core/models/migrationscripts/archived"
+       "github.com/apache/incubator-devlake/helpers/migrationhelper"
+)
+
+type addIssueAssignee20230402 struct {
+       IssueId      string `gorm:"primaryKey;type:varchar(255)"`
+       AssigneeId   string `gorm:"primaryKey;type:varchar(255)"`
+       AssigneeName string `gorm:"type:varchar(255)"`
+
+       archived.NoPKModel
+}
+
+func (*addIssueAssignee20230402) TableName() string {
+       return "issue_assignees"
+}
+
+func (u *addIssueAssignee20230402) Up(basicRes context.BasicRes) errors.Error {
+       return migrationhelper.AutoMigrateTables(
+               basicRes,
+               &addIssueAssignee20230402{},
+       )
+}
+
+func (*addIssueAssignee20230402) Version() uint64 {
+       return 20230402000041
+}
+
+func (*addIssueAssignee20230402) Name() string {
+       return "add issue_assignees table"
+}
diff --git a/backend/core/models/migrationscripts/register.go 
b/backend/core/models/migrationscripts/register.go
index cf069ca82..585855835 100644
--- a/backend/core/models/migrationscripts/register.go
+++ b/backend/core/models/migrationscripts/register.go
@@ -81,6 +81,7 @@ func All() []plugin.MigrationScript {
                new(renameDeploymentIdForPrProjectMetric),
                new(addCommitAuthoredDate),
                new(addOriginalStatusToPullRequest20230508),
+               new(addIssueAssignee20230402),
                new(addCalendarMonths),
                new(modifyPrLabelsAndComments),
                new(renameFinishedCommitsDiffs),
diff --git a/backend/plugins/teambition/e2e/snapshot_tables/issue_assignees.csv 
b/backend/plugins/teambition/e2e/snapshot_tables/issue_assignees.csv
new file mode 100644
index 000000000..1a59809c4
--- /dev/null
+++ b/backend/plugins/teambition/e2e/snapshot_tables/issue_assignees.csv
@@ -0,0 +1,22 @@
+issue_id,assignee_id,assignee_name,created_at,updated_at,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
+teambition:TeambitionTask:1:64132c945f3fd80070965938,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,1,""
+teambition:TeambitionTask:1:641889e2f98ea19169bab8dd,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,3,""
+teambition:TeambitionTask:1:64188f3e7e30eb94d86f8792,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,4,""
+teambition:TeambitionTask:1:6419a2df90097a8c84c5b7b8,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,5,""
+teambition:TeambitionTask:1:6419a2f9344ff5c7682abcc8,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,6,""
+teambition:TeambitionTask:1:6419a357bf79590a54dd3a28,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,7,""
+teambition:TeambitionTask:1:6419a35ff98ea19169bb4a83,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,8,""
+teambition:TeambitionTask:1:6419a3c24bccff5385d90268,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,9,""
+teambition:TeambitionTask:1:6419a3d0e6a450725f9b8205,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,10,""
+teambition:TeambitionTask:1:6419a3e15f3fd8007098bd03,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,11,""
+teambition:TeambitionTask:1:6419a466f407a6bb9c9e31ae,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,12,""
+teambition:TeambitionTask:1:6419aee0762f31f9b2168ca3,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,13,""
+teambition:TeambitionTask:1:6419aee421643c55d9d1117f,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,14,""
+teambition:TeambitionTask:1:6419aeeb1502a928dbcdb66e,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,15,""
+teambition:TeambitionTask:1:6419b1654bccff5385d90590,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,16,""
+teambition:TeambitionTask:1:6419b16f7a4d42ee8e9246db,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,17,""
+teambition:TeambitionTask:1:6419b17472707d4d15e64f86,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,18,""
+teambition:TeambitionTask:1:6419b1b54ed7d8c44b411ba6,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,19,""
+teambition:TeambitionTask:1:6419b1c1640380c7aecefe0e,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,20,""
+teambition:TeambitionTask:1:6419b1c8090e699c15cb72ee,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,21,""
+teambition:TeambitionTask:1:6419b1dabf79590a54dd3d75,5f27709685e4266322e2690a,coldgust,2023-04-02
 08:28:18.724,2023-04-02 
08:28:18.724,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_tasks,22,""
diff --git a/backend/plugins/teambition/e2e/task_test.go 
b/backend/plugins/teambition/e2e/task_test.go
index 37f98dfb1..31d5e41e3 100644
--- a/backend/plugins/teambition/e2e/task_test.go
+++ b/backend/plugins/teambition/e2e/task_test.go
@@ -87,6 +87,7 @@ func TestTeambitionTask(t *testing.T) {
                },
        )
 
+       dataflowTester.FlushTabler(&ticket.IssueAssignee{})
        dataflowTester.FlushTabler(&ticket.Issue{})
        dataflowTester.Subtask(tasks.ConvertTasksMeta, taskData)
        dataflowTester.VerifyTableWithOptions(
@@ -97,4 +98,12 @@ func TestTeambitionTask(t *testing.T) {
                        IgnoreTypes:  []interface{}{domainlayer.DomainEntity{}},
                },
        )
+       dataflowTester.VerifyTableWithOptions(
+               ticket.IssueAssignee{},
+               e2ehelper.TableOptions{
+                       CSVRelPath:   "./snapshot_tables/issue_assignees.csv",
+                       IgnoreFields: []string{"created_date", "logged_date", 
"started_date", "updated_date", "resolution_date"},
+                       IgnoreTypes:  []interface{}{domainlayer.DomainEntity{}},
+               },
+       )
 }
diff --git a/backend/plugins/teambition/tasks/task_converter.go 
b/backend/plugins/teambition/tasks/task_converter.go
index 25d6f547e..aadf8cc33 100644
--- a/backend/plugins/teambition/tasks/task_converter.go
+++ b/backend/plugins/teambition/tasks/task_converter.go
@@ -141,6 +141,13 @@ func ConvertTasks(taskCtx plugin.SubTaskContext) 
errors.Error {
                                        IssueId:  issue.Id,
                                })
                        }
+                       if issue.AssigneeId != "" {
+                               result = append(result, &ticket.IssueAssignee{
+                                       IssueId:      issue.Id,
+                                       AssigneeId:   issue.AssigneeId,
+                                       AssigneeName: issue.AssigneeName,
+                               })
+                       }
 
                        return result, nil
                },

Reply via email to