From 63ffe3feac7f13435cc5314eeda6d1d47b2f597e Mon Sep 17 00:00:00 2001 From: d4x1 <1507509064@qq.com> Date: Tue, 16 Apr 2024 16:55:27 +0800 Subject: [PATCH 1/2] fix(tapd): change iteration_id's type from uint64 to int64 --- backend/plugins/tapd/models/bug.go | 2 +- backend/plugins/tapd/models/bug_changelog.go | 4 ++-- backend/plugins/tapd/models/changelog.go | 4 ++-- backend/plugins/tapd/models/iteration.go | 4 ++-- backend/plugins/tapd/models/iteration_bug.go | 2 +- backend/plugins/tapd/models/iteration_story.go | 2 +- backend/plugins/tapd/models/iteration_task.go | 2 +- backend/plugins/tapd/models/story.go | 2 +- backend/plugins/tapd/models/story_changelog.go | 8 ++++---- backend/plugins/tapd/models/task.go | 2 +- backend/plugins/tapd/models/task_changelog.go | 8 ++++---- backend/plugins/tapd/tasks/bug_changelog_converter.go | 4 ++-- backend/plugins/tapd/tasks/shared.go | 2 +- backend/plugins/tapd/tasks/story_changelog_converter.go | 4 ++-- backend/plugins/tapd/tasks/task_changelog_converter.go | 4 ++-- 15 files changed, 27 insertions(+), 27 deletions(-) diff --git a/backend/plugins/tapd/models/bug.go b/backend/plugins/tapd/models/bug.go index b06b8b8ff9d..0a4c8f93499 100644 --- a/backend/plugins/tapd/models/bug.go +++ b/backend/plugins/tapd/models/bug.go @@ -35,7 +35,7 @@ type TapdBug struct { Begin *common.CSTTime `json:"begin"` Due *common.CSTTime `json:"due"` Priority string `json:"priority" gorm:"type:varchar(255)"` - IterationId uint64 `json:"iteration_id,string"` + IterationId int64 `json:"iteration_id,string"` Source string `json:"source" gorm:"type:varchar(255)"` Module string `json:"module" gorm:"type:varchar(255)"` ReleaseId uint64 `json:"release_id,string"` diff --git a/backend/plugins/tapd/models/bug_changelog.go b/backend/plugins/tapd/models/bug_changelog.go index 3a1186eb720..8b4302b86ae 100644 --- a/backend/plugins/tapd/models/bug_changelog.go +++ b/backend/plugins/tapd/models/bug_changelog.go @@ -41,8 +41,8 @@ type TapdBugChangelogItem struct { Field string `json:"field" gorm:"primaryKey;"` ValueBeforeParsed string `json:"value_before_parsed"` ValueAfterParsed string `json:"value_after_parsed"` - IterationIdFrom uint64 - IterationIdTo uint64 + IterationIdFrom int64 + IterationIdTo int64 common.NoPKModel } diff --git a/backend/plugins/tapd/models/changelog.go b/backend/plugins/tapd/models/changelog.go index 039ca121fd2..4a13852da43 100644 --- a/backend/plugins/tapd/models/changelog.go +++ b/backend/plugins/tapd/models/changelog.go @@ -31,8 +31,8 @@ type ChangelogTmp struct { FieldName string FromValue string ToValue string - IterationIdFrom uint64 - IterationIdTo uint64 + IterationIdFrom int64 + IterationIdTo int64 CreatedDate time.Time common.RawDataOrigin } diff --git a/backend/plugins/tapd/models/iteration.go b/backend/plugins/tapd/models/iteration.go index 540ac5a21bf..16a8f86c0c4 100644 --- a/backend/plugins/tapd/models/iteration.go +++ b/backend/plugins/tapd/models/iteration.go @@ -23,7 +23,7 @@ import ( type TapdIteration struct { ConnectionId uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"` - Id uint64 `gorm:"primaryKey;type:BIGINT NOT NULL;autoIncrement:false" json:"id,string"` + Id int64 `gorm:"primaryKey;type:BIGINT NOT NULL;autoIncrement:false" json:"id,string"` Name string `gorm:"type:varchar(255)" json:"name"` WorkspaceId uint64 `json:"workspace_id,string"` Startdate *common.CSTTime `json:"startdate"` @@ -46,7 +46,7 @@ type TapdWorkspaceIteration struct { common.NoPKModel ConnectionId uint64 `gorm:"primaryKey"` WorkspaceId uint64 `gorm:"primaryKey"` - IterationId uint64 `gorm:"primaryKey"` + IterationId int64 `gorm:"primaryKey"` } func (TapdIteration) TableName() string { diff --git a/backend/plugins/tapd/models/iteration_bug.go b/backend/plugins/tapd/models/iteration_bug.go index 0d86bc98111..6883f99ded1 100644 --- a/backend/plugins/tapd/models/iteration_bug.go +++ b/backend/plugins/tapd/models/iteration_bug.go @@ -24,7 +24,7 @@ import ( type TapdIterationBug struct { common.NoPKModel ConnectionId uint64 `gorm:"primaryKey"` - IterationId uint64 `gorm:"primaryKey"` + IterationId int64 `gorm:"primaryKey"` WorkspaceId uint64 `gorm:"primaryKey"` BugId uint64 `gorm:"primaryKey"` ResolutionDate *common.CSTTime diff --git a/backend/plugins/tapd/models/iteration_story.go b/backend/plugins/tapd/models/iteration_story.go index 775c7c81cc8..76024cec4ca 100644 --- a/backend/plugins/tapd/models/iteration_story.go +++ b/backend/plugins/tapd/models/iteration_story.go @@ -24,7 +24,7 @@ import ( type TapdIterationStory struct { common.NoPKModel ConnectionId uint64 `gorm:"primaryKey"` - IterationId uint64 `gorm:"primaryKey"` + IterationId int64 `gorm:"primaryKey"` WorkspaceId uint64 `gorm:"primaryKey"` StoryId uint64 `gorm:"primaryKey"` diff --git a/backend/plugins/tapd/models/iteration_task.go b/backend/plugins/tapd/models/iteration_task.go index be0a12bf495..0c65ac46c75 100644 --- a/backend/plugins/tapd/models/iteration_task.go +++ b/backend/plugins/tapd/models/iteration_task.go @@ -24,7 +24,7 @@ import ( type TapdIterationTask struct { common.NoPKModel ConnectionId uint64 `gorm:"primaryKey"` - IterationId uint64 `gorm:"primaryKey"` + IterationId int64 `gorm:"primaryKey"` WorkspaceId uint64 `gorm:"primaryKey"` TaskId uint64 `gorm:"primaryKey"` diff --git a/backend/plugins/tapd/models/story.go b/backend/plugins/tapd/models/story.go index 53e7c2cdd9b..76f24252b0a 100644 --- a/backend/plugins/tapd/models/story.go +++ b/backend/plugins/tapd/models/story.go @@ -39,7 +39,7 @@ type TapdStory struct { Size int16 `json:"size,string"` Priority string `gorm:"type:varchar(255)" json:"priority"` Developer string `gorm:"type:varchar(255)" json:"developer"` - IterationId uint64 `json:"iteration_id,string"` + IterationId int64 `json:"iteration_id,string"` TestFocus string `json:"test_focus" gorm:"type:varchar(255)"` Type string `json:"type" gorm:"type:varchar(255)"` Source string `json:"source" gorm:"type:varchar(255)"` diff --git a/backend/plugins/tapd/models/story_changelog.go b/backend/plugins/tapd/models/story_changelog.go index 64d9f371b52..ed559af7f20 100644 --- a/backend/plugins/tapd/models/story_changelog.go +++ b/backend/plugins/tapd/models/story_changelog.go @@ -47,8 +47,8 @@ type TapdStoryChangelogItemRes struct { ValueAfterParsed json.RawMessage `json:"value_after_parsed"` ValueBefore json.RawMessage `json:"value_before"` ValueAfter json.RawMessage `json:"value_after"` - IterationIdFrom uint64 - IterationIdTo uint64 + IterationIdFrom int64 + IterationIdTo int64 common.NoPKModel } @@ -58,8 +58,8 @@ type TapdStoryChangelogItem struct { Field string `json:"field" gorm:"primaryKey;type:varchar(255)"` ValueBeforeParsed string `json:"value_before_parsed"` ValueAfterParsed string `json:"value_after_parsed"` - IterationIdFrom uint64 - IterationIdTo uint64 + IterationIdFrom int64 + IterationIdTo int64 common.NoPKModel } diff --git a/backend/plugins/tapd/models/task.go b/backend/plugins/tapd/models/task.go index bd285c467d4..b10f94bae91 100644 --- a/backend/plugins/tapd/models/task.go +++ b/backend/plugins/tapd/models/task.go @@ -36,7 +36,7 @@ type TapdTask struct { Begin *common.CSTTime `json:"begin"` Due *common.CSTTime `json:"due"` Priority string `gorm:"type:varchar(255)" json:"priority"` - IterationId uint64 `json:"iteration_id,string"` + IterationId int64 `json:"iteration_id,string"` Completed *common.CSTTime `json:"completed"` Effort float32 `json:"effort,string"` EffortCompleted float32 `json:"effort_completed,string"` diff --git a/backend/plugins/tapd/models/task_changelog.go b/backend/plugins/tapd/models/task_changelog.go index b6c50daac66..7d0f45481ba 100644 --- a/backend/plugins/tapd/models/task_changelog.go +++ b/backend/plugins/tapd/models/task_changelog.go @@ -46,8 +46,8 @@ type TapdTaskChangelogItem struct { Field string `json:"field" gorm:"primaryKey;type:varchar(255)"` ValueBeforeParsed string `json:"value_before_parsed"` ValueAfterParsed string `json:"value_after_parsed"` - IterationIdFrom uint64 - IterationIdTo uint64 + IterationIdFrom int64 + IterationIdTo int64 common.NoPKModel } @@ -59,8 +59,8 @@ type TapdTaskChangelogItemRes struct { ValueAfterParsed json.RawMessage `json:"value_after_parsed"` ValueBefore json.RawMessage `json:"value_before"` ValueAfter json.RawMessage `json:"value_after"` - IterationIdFrom uint64 - IterationIdTo uint64 + IterationIdFrom int64 + IterationIdTo int64 common.NoPKModel } diff --git a/backend/plugins/tapd/tasks/bug_changelog_converter.go b/backend/plugins/tapd/tasks/bug_changelog_converter.go index 3d87497b3d1..0ec3699c0e2 100644 --- a/backend/plugins/tapd/tasks/bug_changelog_converter.go +++ b/backend/plugins/tapd/tasks/bug_changelog_converter.go @@ -46,8 +46,8 @@ type BugChangelogItemResult struct { ChangelogId uint64 `gorm:"primaryKey;type:BIGINT NOT NULL"` ValueBeforeParsed string `json:"value_before"` ValueAfterParsed string `json:"value_after"` - IterationIdFrom uint64 - IterationIdTo uint64 + IterationIdFrom int64 + IterationIdTo int64 common.NoPKModel } diff --git a/backend/plugins/tapd/tasks/shared.go b/backend/plugins/tapd/tasks/shared.go index 25487b9bc72..3f69865571b 100644 --- a/backend/plugins/tapd/tasks/shared.go +++ b/backend/plugins/tapd/tasks/shared.go @@ -98,7 +98,7 @@ func GetTotalPagesFromResponse(r *http.Response, args *api.ApiCollectorArgs) (in } // parseIterationChangelog function is used to parse the iteration changelog -func parseIterationChangelog(taskCtx plugin.SubTaskContext, old string, new string) (iterationFromId uint64, iterationToId uint64, err errors.Error) { +func parseIterationChangelog(taskCtx plugin.SubTaskContext, old string, new string) (iterationFromId int64, iterationToId int64, err errors.Error) { data := taskCtx.GetData().(*TapdTaskData) db := taskCtx.GetDal() diff --git a/backend/plugins/tapd/tasks/story_changelog_converter.go b/backend/plugins/tapd/tasks/story_changelog_converter.go index c075d2f596a..a51b106a5ec 100644 --- a/backend/plugins/tapd/tasks/story_changelog_converter.go +++ b/backend/plugins/tapd/tasks/story_changelog_converter.go @@ -49,8 +49,8 @@ type StoryChangelogItemResult struct { Field string `json:"field" gorm:"primaryKey;type:varchar(255)"` ValueBeforeParsed string `json:"value_before"` ValueAfterParsed string `json:"value_after"` - IterationIdFrom uint64 - IterationIdTo uint64 + IterationIdFrom int64 + IterationIdTo int64 common.NoPKModel } diff --git a/backend/plugins/tapd/tasks/task_changelog_converter.go b/backend/plugins/tapd/tasks/task_changelog_converter.go index d92c8c991e1..d82e642aa9f 100644 --- a/backend/plugins/tapd/tasks/task_changelog_converter.go +++ b/backend/plugins/tapd/tasks/task_changelog_converter.go @@ -50,8 +50,8 @@ type TaskChangelogItemResult struct { Field string `json:"field" gorm:"primaryKey;type:varchar(255)"` ValueBeforeParsed string `json:"value_before"` ValueAfterParsed string `json:"value_after"` - IterationIdFrom uint64 - IterationIdTo uint64 + IterationIdFrom int64 + IterationIdTo int64 common.NoPKModel } From 3bcf8bac1a62140932d1ef8438e11b09bb0cb18c Mon Sep 17 00:00:00 2001 From: d4x1 <1507509064@qq.com> Date: Tue, 16 Apr 2024 17:04:01 +0800 Subject: [PATCH 2/2] fix(tapd): fix test --- backend/plugins/tapd/tasks/shared_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/plugins/tapd/tasks/shared_test.go b/backend/plugins/tapd/tasks/shared_test.go index 96835069f78..6763d5b5894 100644 --- a/backend/plugins/tapd/tasks/shared_test.go +++ b/backend/plugins/tapd/tasks/shared_test.go @@ -64,8 +64,8 @@ func TestParseIterationChangelog(t *testing.T) { }).Return(nil).Once() // Test case 2: success scenario iterationFromId, iterationToId, err := parseIterationChangelog(mockCtx, "old", "new") - assert.Equal(t, uint64(1), iterationFromId) - assert.Equal(t, uint64(2), iterationToId) + assert.Equal(t, int64(1), iterationFromId) + assert.Equal(t, int64(2), iterationToId) assert.Nil(t, err) }