コード例 #1
0
ファイル: issue.py プロジェクト: xintao222/yun_mobile
def issue_export():
    """
    @api {get} /v1/issue/ 导出 issue 到 xls
    @apiName IssueExportToXls
    @apiGroup 项目
    @apiDescription 导出 issue 到 xls
    @apiParam {int} [projectid] 项目 ID
    @apiParam {int} [versionid] 版本 ID
    @apiParam {int} [creator_id] 创建人 ID
    @apiParam {int} [title] 标题
    @apiParam {int} [handle_status] 处理状态 ID
    @apiParam {int} [module_id] 模块 ID
    @apiParam {int} [priority] 优先级 ID
    @apiParam {int} [page_size] 分页 页面大小
    @apiparam {int} [page_index] 分页 页数
    @apiParamExample {json} Request-Example:
    {
        "projectid": 4,
        "versionid": 173,
        "page_size": 1
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": "http://tcloud-static.oss-cn-beijing.aliyuncs.com/issue_export/0/Issues-20190809.164431.xls",
        "message": "ok"
    }
    """
    issue_url = IssueBusiness.export()
    return json_detail_render(code=0, data=issue_url)
コード例 #2
0
def issue_add_handler():
    """
    @api {post} /v1/issue 新增 缺陷
    @apiName CreateIssue
    @apiGroup 项目
    @apiDescription 新增 缺陷
    @apiParam {int} module_id 模块 ID
    @apiParam {int} handler 处理人 ID
    @apiParam {int} issue_type 类型
    @apiParam {int} chance 出现几率
    @apiParam {int} level 级别
    @apiParam {int} priority 优先级
    @apiParam {int} system 系统
    @apiParam {string} title 标题
    @apiParam {string} attach 福建
    @apiParam {string} description 描述
    @apiParam {int} detection_chance 用户识别度
    @apiParam {int} project_id 项目 ID
    @apiParam {int} version 版本
    @apiParam {int} creator 创建人 ID
    @apiParam {int} modifier 修改人 ID
    @apiParam {int} [requirement_id] 关联的 需求 ID
    @apiParamExample {json} Request-Example:
    {
        "module_id": 340,
        "handler": 93,
        "issue_type": 0,
        "chance": 0,
        "level": 0,
        "priority": 0,
        "system": 4,
        "title": "123",
        "attach": "{\"images\":[],\"files\":[],\"videos\":[]}",
        "description": "<p>test</p>",
        "detection_chance": 0,
        "project_id": 4,
        "version": 168,
        "creator": 93,
        "modifier": 93,
        "requirement_id": 123
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": [],
        "message": "ok"
    }
    """
    (system, version, project_id, module_id, creator, modifier, handler,
     issue_type, chance, level, priority, stage, title, attach, handle_status,
     description, comment, detection_chance, requirement_id,
     case_covered) = parse_json_form('issue_create')
    ret = IssueBusiness.create(system, version, project_id, module_id, creator,
                               modifier, handler, issue_type, chance, level,
                               priority, stage, title, attach, handle_status,
                               description, comment, detection_chance,
                               requirement_id, case_covered)

    return json_detail_render(ret)
コード例 #3
0
ファイル: issue.py プロジェクト: xintao222/yun_mobile
def issue_delete_handler(issue_id):
    """
    @api {delete} /v1/issue/{int:id} 删除 缺陷
    @apiName DeleteIssue
    @apiGroup 项目
    @apiDescription 删除 缺陷
    @apiParamExample {json} Request-Example:
    -
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": [],
        "message": "ok"
    }
    """
    ret = IssueBusiness.delete(issue_id)
    return json_detail_render(ret)
コード例 #4
0
ファイル: issue.py プロジェクト: xintao222/yun_mobile
def issue_add_comment_handler(issue_id):
    """
    @api {post} /v1/issue/comment/{int:id} 切换 缺陷备注
    @apiName ModifyIssueComment
    @apiGroup 项目
    @apiDescription 切换 缺陷备注
    @apiParamExample {json} Request-Example:
    {
        "comment": 3
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": [],
        "message": "ok"
    }
    """
    comment = parse_json_form('add_comment')
    ret = IssueBusiness.add_comment(issue_id, comment)

    return json_detail_render(ret)
コード例 #5
0
ファイル: issue.py プロジェクト: xintao222/yun_mobile
def issue_priority_switch_handler(issue_id):
    """
    @api {post} /v1/issue/priority/{int:id} 切换 缺陷优先级
    @apiName ModifyIssuePriority
    @apiGroup 项目
    @apiDescription 切换 缺陷优先级
    @apiParamExample {json} Request-Example:
    {
        "priority": 3
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": [],
        "message": "ok"
    }
    """
    priority = parse_json_form('priority_switch')
    ret = IssueBusiness.priority_switch(issue_id, priority)

    return json_detail_render(ret)
コード例 #6
0
ファイル: issue.py プロジェクト: xintao222/yun_mobile
def issue_level_switch_handler(issue_id):
    """
    @api {post} /v1/issue/level/{int:id} 切换 缺陷等级
    @apiName ModifyIssueLevel
    @apiGroup 项目
    @apiDescription 切换 缺陷等级
    @apiParamExample {json} Request-Example:
    {
        "level": 3
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": [],
        "message": "ok"
    }
    """
    level = parse_json_form('level_switch')
    ret = IssueBusiness.level_switch(issue_id, level)

    return json_detail_render(ret)
コード例 #7
0
ファイル: issue.py プロジェクト: xintao222/yun_mobile
def issue_handler_switch_handler(issue_id):
    """
    @api {post} /v1/issue/handler/{int:id} 切换 缺陷处理人
    @apiName ModifyIssueSwitch
    @apiGroup 项目
    @apiDescription 切换 缺陷处理人
    @apiParamExample {json} Request-Example:
    {
        "handler": 11
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": [],
        "message": "ok"
    }
    """
    handler = parse_json_form('handler_switch')
    ret = IssueBusiness.handler_switch(issue_id, handler)

    return json_detail_render(ret)
コード例 #8
0
ファイル: issue.py プロジェクト: xintao222/yun_mobile
def issue_board_status_handler(issue_id):
    """
    @api {post} /v1/issue/handlestatus/{int:id} 切换 缺陷状态
    @apiName ModifyIssueStatus
    @apiGroup 项目
    @apiDescription 切换 缺陷状态
    @apiParamExample {json} Request-Example:
    {
        "handle_status": 1
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": [],
        "message": "ok"
    }
    """
    handle_status = parse_json_form('handle_status')[0]
    ret = IssueBusiness.status_switch(issue_id, handle_status)

    return json_detail_render(ret)
コード例 #9
0
ファイル: issue.py プロジェクト: xintao222/yun_mobile
def issue_bind_requirement():
    """
    @api {post} /v1/issue/bind/requirement 绑定 缺陷 issue 到 需求 requirement
    @apiName IssueBindRequirement
    @apiGroup 项目
    @apiDescription 绑定 缺陷到需求
    @apiParam {int} issue_id 缺陷 ID
    @apiParam {int} requirement_id 需求 ID
    @apiParamExample {json} Request-Example:
    {
        "issue": 11,
        "requirement_id": 22
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
     {
        "code": 0,
        "data": [],
        "message": "ok"
    }
    """
    requirement_id, issue_id = parse_json_form('issue_bind_requirement')
    ret, msg = IssueBusiness.issue_bind_requirement(issue_id, requirement_id)
    return json_detail_render(ret, [], msg)
コード例 #10
0
ファイル: taskcase.py プロジェクト: xintao222/yun_mobile
def task_case_relation_handler():
    """
    @api {post} /v1/taskcase/relation/ 关联 taskcase和issue
    @apiName RelationTaskCaseAndIssue
    @apiGroup 项目
    @apiDescription 关联taskcase和issue
    @apiParam {int} task_case_id taskcase的id
    @apiParam {int} issue_id issue的id
    @apiParamExample {json} Request-Example:
    {
        "task_case_id": 1,
        "issue_id": 1
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
     {
        "code": 0,
        "data": [],
        "message": "ok"
    }
    """
    task_case_id, issue_id = parse_json_form('case_relation_issue')
    ret = IssueBusiness.relation_issue(task_case_id, issue_id)
    return json_detail_render(ret)
コード例 #11
0
ファイル: issue.py プロジェクト: xintao222/yun_mobile
def issue_query_handler(issue_id):
    """
   @api {get} /v1/issue/{int:issue_id} 查询 缺陷详情 (id)
   @apiName GetIssueById
   @apiGroup 项目
   @apiDescription 查询 缺陷详情 通过 ID
   @apiParamExample {json} Request-Example:
   -
   @apiSuccessExample {json} Success-Response:
    HTTP/1.1 200 OK
    {
        "code":0,
        "data":[
            {
                "attach":"attach",
                "chance":1,
                "comment":"",
                "creation_time":"2018-12-18 20:28:39",
                "creator":[
                    {
                        "id":1,
                        "name":"王金龙"
                    }
                ],
                "description":"description",
                "handle_status":3,
                "handler":[
                    {
                        "id":1,
                        "name":"王金龙"
                    }
                ],
                "issue_number":"T1",
                "issue_type":1,
                "issueid":1,
                "level":1,
                "modified_time":"2019-03-01 16:46:10",
                "modifier":[
                    {
                        "id":1,
                        "name":"王金龙"
                    }
                ],
                "module":[
                    {
                        "id":1,
                        "name":"音频"
                    }
                ],
                "priority":1,
                "project_id":1,
                "reopen":0,
                "repair_time":"0:00:05",
                "requirement_id":"",
                "requirement_title":"",
                "stage":1,
                "status":0,
                "system":0,
                "test_time":"2 days, 20:21:05",
                "title":"title",
                "version":[
                    {
                        "id":1,
                        "name":"str"
                    }
                ],
                "weight":""
            }
        ],
        "message":"ok"
    }
   """
    data = IssueBusiness.query_by_id(issue_id)

    return json_detail_render(0, data)
コード例 #12
0
ファイル: issue.py プロジェクト: xintao222/yun_mobile
def issue_query_all_handler():
    """
    @api {get} /v1/issue/ 查询 issue 列表
    @apiName SearchIssue
    @apiGroup 项目
    @apiDescription 查询 issue 列表
    @apiParam {int} [projectid] 项目 ID
    @apiParam {int} [versionid] 版本 ID
    @apiParam {string} [creator_id] 创建人 ID,使用 ',' 分割
    @apiParam {string} [handler_id] 处理人 ID,使用 ',' 分割
    @apiParam {int} [title] 标题
    @apiParam {string} [handle_status] 处理状态 ID,使用 ',' 分割
    @apiParam {string} [module_id] 模块 ID,使用 ',' 分割
    @apiParam {string} [priority] 优先级 ID,使用 ',' 分割
    @apiParam {int} [page_size] 分页 页面大小
    @apiparam {int} [page_index] 分页 页数
    @apiParamExample {json} Request-Example:
    {
        "projectid": 4,
        "versionid": 173,
        "creator_id": "1,2,3,4",
        "page_size": 1
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": [
            {
                "attach": "{"images":[],"files":[],"videos":[]}",
                "chance": 2,
                "comment": "",
                "creation_time": "2019-08-08 20:58:49",
                "creator": [
                    {
                    "id": 96,
                    "name": "张宇"
                    }
                ],
                "description": "",
                "detection_chance": "",
                "handle_status": 2,
                "handler": [
                    {
                    "id": 96,
                    "name": "张宇"
                    }
                ],
                "issue_number": "T398",
                "issue_type": 1,
                "issueid": 398,
                "level": 1,
                "modified_time": "2019-08-08 20:58:49",
                "modifier": [],
                "module": [
                    {
                    "id": 329,
                    "name": "用例二级2222"
                    }
                ],
                "priority": 1,
                "project_id": 4,
                "rank": 12,
                "reopen": 0,
                "repair_time": "",
                "requirement_id": "",
                "requirement_title": "",
                "stage": "",
                "status": 0,
                "system": "",
                "test_time": "",
                "title": "1.2.7issuse55555",
                "version": [
                    {
                    "id": 173,
                    "name": "1.2.7"
                    }
                ],
                "weight": ""
            }
        ],
        "message": "ok",
        "page_index": 1,
        "page_size": 1,
        "total": 8
    }
    """
    requirement_id = request.args.get('requirement_id')
    if requirement_id:
        page_size, page_index = parse_list_args2()
        data, count = IssueBusiness.paginate_data_by_rid(
            page_size, page_index, requirement_id)
        return json_list_render2(0, data, page_size, page_index, count)
    else:
        page_size, page_index = parse_list_args2()
        data, count = IssueBusiness.paginate_data(page_size, page_index)
        return json_list_render2(0, data, page_size, page_index, count)