You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/09/25 13:43:51 UTC

[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #3181: feat(zentao): add zentao stories

warren830 commented on code in PR #3181:
URL: https://github.com/apache/incubator-devlake/pull/3181#discussion_r979409042


##########
plugins/zentao/zentao.go:
##########
@@ -34,13 +34,15 @@ func main() {
 	executionId := cmd.Flags().IntP("executionId", "e", 8, "execution id")
 	productId := cmd.Flags().IntP("productId", "o", 8, "product id")
 	projectId := cmd.Flags().IntP("projectId", "p", 8, "project id")
+	storiesId := cmd.Flags().IntP("storiesId", "s", 1, "stories id")
 
 	cmd.Run = func(cmd *cobra.Command, args []string) {
 		runner.DirectRun(cmd, args, PluginEntry, map[string]interface{}{
 			"connectionId": *connectionId,
 			"executionId":  *executionId,
 			"productId":    *productId,
 			"projectId":    *projectId,
+			"storiesId":    *storiesId,

Review Comment:
   why do you add this param?
   



##########
plugins/zentao/tasks/stories_collector.go:
##########
@@ -0,0 +1,77 @@
+/*
+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 (
+	"encoding/json"
+	"fmt"
+	"github.com/apache/incubator-devlake/plugins/core"
+	"github.com/apache/incubator-devlake/plugins/helper"
+	"io"
+	"net/http"
+	"net/url"
+)
+
+const RAW_STORIES_TABLE = "zentao_stories"
+
+var _ core.SubTaskEntryPoint = CollectExecution
+
+func CollectStories(taskCtx core.SubTaskContext) error {
+	data := taskCtx.GetData().(*ZentaoTaskData)
+	collector, err := helper.NewApiCollector(helper.ApiCollectorArgs{
+		RawDataSubTaskArgs: helper.RawDataSubTaskArgs{
+			Ctx: taskCtx,
+			Params: ZentaoApiParams{
+				StoriesId: data.Options.StoriesId,
+			},
+			Table: RAW_STORIES_TABLE,
+		},
+		ApiClient:   data.ApiClient,
+		Incremental: false,
+		PageSize:    100,
+		// TODO write which api would you want request
+		UrlTemplate: "/stories/{{ .Params.StoriesId }}",

Review Comment:
   we should use : /executions/:id/stories
   this will return all stories 



##########
plugins/zentao/tasks/task_data.go:
##########
@@ -40,6 +41,7 @@ type ZentaoOptions struct {
 	ProjectId    uint64
 	Tasks        []string `json:"tasks,omitempty"`
 	Since        string
+	StoriesId    uint64

Review Comment:
   I think we should add execution id here, not stories



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org