From fa09f6349e6f656f84fcb277f0ebd3e852fb36f2 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Mon, 14 Mar 2022 16:19:56 +0800 Subject: [PATCH] *Get the execution stories under the module API. --- api/v1/entries/modulestories.php | 33 ++++++++++++++++++++++++++++++++ config/routes.php | 2 ++ 2 files changed, 35 insertions(+) create mode 100644 api/v1/entries/modulestories.php diff --git a/api/v1/entries/modulestories.php b/api/v1/entries/modulestories.php new file mode 100644 index 0000000000..ce2c95fa5d --- /dev/null +++ b/api/v1/entries/modulestories.php @@ -0,0 +1,33 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + */ +class moduleStoriesEntry extends Entry +{ + public function get($moduleID) + { + $executionID = $this->param('executionID', 0); + if(!$executionID) $executionID = $this->param('executionID', 0); + if(empty($executionID)) return $this->sendError(400, 'Need execution id.'); + $control = $this->loadController('story', 'ajaxGetExecutionStories'); + $control->ajaxGetExecutionStories($executionID, $this->param('productID', 0), $this->param('branchID', 0), $moduleID); + + $data = $this->getData(); + $this->loadModel('story'); + $result = []; + foreach($data as $storyID => $storyName) + { + if(empty($storyID)) continue; + $story = $this->story->getById($storyID); + $result[] = $this->filterFields($story, 'id,title,module,pri,status,stage,estimate'); + } + return $this->send(200, array('stories' => $result)); + } +} diff --git a/config/routes.php b/config/routes.php index b6073b28fd..f7b8dba007 100644 --- a/config/routes.php +++ b/config/routes.php @@ -46,6 +46,8 @@ $routes['/executions/:id/stories'] = 'executionStories'; $routes['/stories/:id'] = 'story'; $routes['/stories/:id/change'] = 'storyChange'; +$routes['/module/:id/stories'] = 'moduleStories'; + $routes['/products/:id/bugs'] = 'bugs'; $routes['/projects/:id/bugs'] = 'projectBugs'; $routes['/executions/:id/bugs'] = 'executionBugs';