You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by wa...@apache.org on 2022/09/24 14:06:14 UTC

[incubator-devlake] 01/03: fix(zentao): fix minor issues

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

warren pushed a commit to branch feat-plugin-zentao
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit f32f638df815e5990abc92ab5e0a6b04c736cd0c
Author: Yingchu Chen <yi...@merico.dev>
AuthorDate: Sun Sep 18 21:40:57 2022 +0800

    fix(zentao): fix minor issues
---
 plugins/zentao/models/archived/project.go       | 54 ++++++++++++-------------
 plugins/zentao/models/{archived => }/project.go | 52 ++++++++++++------------
 plugins/zentao/tasks/project_extractor.go       |  4 +-
 3 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/plugins/zentao/models/archived/project.go b/plugins/zentao/models/archived/project.go
index db79cceb..63c498dd 100644
--- a/plugins/zentao/models/archived/project.go
+++ b/plugins/zentao/models/archived/project.go
@@ -18,12 +18,12 @@ limitations under the License.
 package archived
 
 import (
-	"github.com/apache/incubator-devlake/models/common"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
 	"time"
 )
 
 type ZentaoProject struct {
-	common.NoPKModel
+	archived.NoPKModel
 	ConnectionId  uint64 `gorm:"primaryKey;type:BIGINT  NOT NULL"`
 	ID            int    `json:"id"`
 	Project       int    `json:"project"`
@@ -56,31 +56,31 @@ type ZentaoProject struct {
 	PlanDuration  int    `json:"planDuration"`
 	RealDuration  int    `json:"realDuration"`
 	//OpenedBy       string    `json:"openedBy"`
-	OpenedDate     time.Time `json:"openedDate"`
-	OpenedVersion  string    `json:"openedVersion"`
-	LastEditedBy   string    `json:"lastEditedBy"`
-	LastEditedDate time.Time `json:"lastEditedDate"`
-	//ClosedBy       string    `json:"closedBy"`
-	//ClosedDate     string    `json:"closedDate"`
-	//CanceledBy string `json:"canceledBy"`
-	//CanceledDate   string    `json:"canceledDate"`
-	SuspendedDate string `json:"suspendedDate"`
-	PO            string `json:"PO"`
-	PM            `json:"PM"`
-	QD            string `json:"QD"`
-	RD            string `json:"RD"`
-	Team          string `json:"team"`
-	Acl           string `json:"acl"`
-	Whitelist     `json:"whitelist" gorm:"-"`
-	Order         int    `json:"order"`
-	Vision        string `json:"vision"`
-	DisplayCards  int    `json:"displayCards"`
-	FluidBoard    string `json:"fluidBoard"`
-	Deleted       bool   `json:"deleted"`
-	Delay         int    `json:"delay"`
-	Hours         `json:"hours"`
-	TeamCount     int    `json:"teamCount"`
-	LeftTasks     string `json:"leftTasks"`
+	OpenedDate     time.Time  `json:"openedDate"`
+	OpenedVersion  string     `json:"openedVersion"`
+	LastEditedBy   string     `json:"lastEditedBy"`
+	LastEditedDate *time.Time `json:"lastEditedDate"`
+	ClosedBy       string     `json:"closedBy"`
+	ClosedDate     *time.Time `json:"closedDate"`
+	CanceledBy     string     `json:"canceledBy"`
+	CanceledDate   *time.Time `json:"canceledDate"`
+	SuspendedDate  string     `json:"suspendedDate"`
+	PO             string     `json:"PO"`
+	PM             `json:"PM"`
+	QD             string `json:"QD"`
+	RD             string `json:"RD"`
+	Team           string `json:"team"`
+	Acl            string `json:"acl"`
+	Whitelist      `json:"whitelist" gorm:"-"`
+	Order          int    `json:"order"`
+	Vision         string `json:"vision"`
+	DisplayCards   int    `json:"displayCards"`
+	FluidBoard     string `json:"fluidBoard"`
+	Deleted        bool   `json:"deleted"`
+	Delay          int    `json:"delay"`
+	Hours          `json:"hours"`
+	TeamCount      int    `json:"teamCount"`
+	LeftTasks      string `json:"leftTasks"`
 	//TeamMembers   []interface{} `json:"teamMembers" gorm:"-"`
 	TotalEstimate int `json:"totalEstimate"`
 	TotalConsumed int `json:"totalConsumed"`
diff --git a/plugins/zentao/models/archived/project.go b/plugins/zentao/models/project.go
similarity index 73%
copy from plugins/zentao/models/archived/project.go
copy to plugins/zentao/models/project.go
index db79cceb..5a51d738 100644
--- a/plugins/zentao/models/archived/project.go
+++ b/plugins/zentao/models/project.go
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package archived
+package models
 
 import (
 	"github.com/apache/incubator-devlake/models/common"
@@ -56,31 +56,31 @@ type ZentaoProject struct {
 	PlanDuration  int    `json:"planDuration"`
 	RealDuration  int    `json:"realDuration"`
 	//OpenedBy       string    `json:"openedBy"`
-	OpenedDate     time.Time `json:"openedDate"`
-	OpenedVersion  string    `json:"openedVersion"`
-	LastEditedBy   string    `json:"lastEditedBy"`
-	LastEditedDate time.Time `json:"lastEditedDate"`
-	//ClosedBy       string    `json:"closedBy"`
-	//ClosedDate     string    `json:"closedDate"`
-	//CanceledBy string `json:"canceledBy"`
-	//CanceledDate   string    `json:"canceledDate"`
-	SuspendedDate string `json:"suspendedDate"`
-	PO            string `json:"PO"`
-	PM            `json:"PM"`
-	QD            string `json:"QD"`
-	RD            string `json:"RD"`
-	Team          string `json:"team"`
-	Acl           string `json:"acl"`
-	Whitelist     `json:"whitelist" gorm:"-"`
-	Order         int    `json:"order"`
-	Vision        string `json:"vision"`
-	DisplayCards  int    `json:"displayCards"`
-	FluidBoard    string `json:"fluidBoard"`
-	Deleted       bool   `json:"deleted"`
-	Delay         int    `json:"delay"`
-	Hours         `json:"hours"`
-	TeamCount     int    `json:"teamCount"`
-	LeftTasks     string `json:"leftTasks"`
+	OpenedDate     time.Time  `json:"openedDate"`
+	OpenedVersion  string     `json:"openedVersion"`
+	LastEditedBy   string     `json:"lastEditedBy"`
+	LastEditedDate *time.Time `json:"lastEditedDate,string"`
+	ClosedBy       string     `json:"closedBy"`
+	ClosedDate     *time.Time `json:"closedDate,string"`
+	CanceledBy     string     `json:"canceledBy"`
+	CanceledDate   *time.Time `json:"canceledDate,string"`
+	SuspendedDate  string     `json:"suspendedDate"`
+	PO             string     `json:"PO"`
+	PM             `json:"PM"`
+	QD             string `json:"QD"`
+	RD             string `json:"RD"`
+	Team           string `json:"team"`
+	Acl            string `json:"acl"`
+	Whitelist      `json:"whitelist" gorm:"-"`
+	Order          int    `json:"order"`
+	Vision         string `json:"vision"`
+	DisplayCards   int    `json:"displayCards"`
+	FluidBoard     string `json:"fluidBoard"`
+	Deleted        bool   `json:"deleted"`
+	Delay          int    `json:"delay"`
+	Hours          `json:"hours"`
+	TeamCount      int    `json:"teamCount"`
+	LeftTasks      string `json:"leftTasks"`
 	//TeamMembers   []interface{} `json:"teamMembers" gorm:"-"`
 	TotalEstimate int `json:"totalEstimate"`
 	TotalConsumed int `json:"totalConsumed"`
diff --git a/plugins/zentao/tasks/project_extractor.go b/plugins/zentao/tasks/project_extractor.go
index 6cc9d9e5..a1388efa 100644
--- a/plugins/zentao/tasks/project_extractor.go
+++ b/plugins/zentao/tasks/project_extractor.go
@@ -21,7 +21,7 @@ import (
 	"encoding/json"
 	"github.com/apache/incubator-devlake/plugins/core"
 	"github.com/apache/incubator-devlake/plugins/helper"
-	"github.com/apache/incubator-devlake/plugins/zentao/models/archived"
+	"github.com/apache/incubator-devlake/plugins/zentao/models"
 )
 
 var _ core.SubTaskEntryPoint = ExtractProjects
@@ -43,7 +43,7 @@ func ExtractProjects(taskCtx core.SubTaskContext) error {
 			Table:  RAW_PROJECT_TABLE,
 		},
 		Extract: func(row *helper.RawData) ([]interface{}, error) {
-			project := &archived.ZentaoProject{}
+			project := &models.ZentaoProject{}
 			err := json.Unmarshal(row.Data, project)
 			if err != nil {
 				return nil, err