Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
4c46c9a9
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4c46c9a9
编写于
10月 14, 2016
作者:
R
Robert Schilling
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Grapify boards API
上级
4b889dbb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
31 deletion
+45
-31
lib/api/boards.rb
lib/api/boards.rb
+45
-31
未找到文件。
lib/api/boards.rb
浏览文件 @
4c46c9a9
...
...
@@ -3,19 +3,28 @@ module API
class
Boards
<
Grape
::
API
before
{
authenticate!
}
params
do
requires
:id
,
type:
String
,
desc:
'The ID of a project'
end
resource
:projects
do
# Get the project board
desc
'Get all project boards'
do
detail
'This feature was introduced in 8.13'
success
Entities
::
Board
end
get
':id/boards'
do
authorize!
(
:read_board
,
user_project
)
present
user_project
.
boards
,
with:
Entities
::
Board
end
params
do
requires
:board_id
,
type:
Integer
,
desc:
'The ID of a board'
end
segment
':id/boards/:board_id'
do
helpers
do
def
project_board
board
=
user_project
.
boards
.
first
if
params
[
:board_id
]
.
to_i
==
board
.
id
if
params
[
:board_id
]
==
board
.
id
board
else
not_found!
(
'Board'
)
...
...
@@ -27,29 +36,35 @@ module API
end
end
# Get the lists of a project board
# Does not include `backlog` and `done` lists
desc
'Get the lists of a project board'
do
detail
'Does not include `backlog` and `done` lists. This feature was introduced in 8.13'
success
Entities
::
List
end
get
'/lists'
do
authorize!
(
:read_board
,
user_project
)
present
board_lists
,
with:
Entities
::
List
end
# Get a list of a project board
desc
'Get a list of a project board'
do
detail
'This feature was introduced in 8.13'
success
Entities
::
List
end
params
do
requires
:list_id
,
type:
Integer
,
desc:
'The ID of a list'
end
get
'/lists/:list_id'
do
authorize!
(
:read_board
,
user_project
)
present
board_lists
.
find
(
params
[
:list_id
]),
with:
Entities
::
List
end
# Create a new board list
#
# Parameters:
# id (required) - The ID of a project
# label_id (required) - The ID of an existing label
# Example Request:
# POST /projects/:id/boards/:board_id/lists
desc
'Create a new board list'
do
detail
'This feature was introduced in 8.13'
success
Entities
::
List
end
params
do
requires
:label_id
,
type:
Integer
,
desc:
'The ID of an existing label'
end
post
'/lists'
do
required_attributes!
[
:label_id
]
unless
user_project
.
labels
.
exists?
(
params
[
:label_id
])
render_api_error!
({
error:
"Label not found!"
},
400
)
end
...
...
@@ -68,21 +83,21 @@ module API
end
end
# Moves a board list to a new position
#
# Parameters:
# id (required) - The ID of a project
# board_id (required) - The ID of a board
# position (required) - The position of the list
# Example Request:
# PUT /projects/:id/boards/:board_id/lists/:list_i
d
desc
'Moves a board list to a new position'
do
detail
'This feature was introduced in 8.13'
success
Entities
::
List
end
params
do
requires
:list_id
,
type:
Integer
,
desc:
'The ID of a list'
requires
:position
,
type:
Integer
,
desc:
'The position of the list'
en
d
put
'/lists/:list_id'
do
list
=
project_board
.
lists
.
movable
.
find
(
params
[
:list_id
])
authorize!
(
:admin_list
,
user_project
)
service
=
::
Boards
::
Lists
::
MoveService
.
new
(
user_project
,
current_user
,
{
position:
params
[
:position
]
.
to_i
})
{
position:
params
[
:position
]
})
if
service
.
execute
(
list
)
present
list
,
with:
Entities
::
List
...
...
@@ -91,14 +106,13 @@ module API
end
end
# Delete a board list
#
# Parameters:
# id (required) - The ID of a project
# board_id (required) - The ID of a board
# list_id (required) - The ID of a board list
# Example Request:
# DELETE /projects/:id/boards/:board_id/lists/:list_id
desc
'Delete a board list'
do
detail
'This feature was introduced in 8.13'
success
Entities
::
List
end
params
do
requires
:list_id
,
type:
Integer
,
desc:
'The ID of a board list'
end
delete
"/lists/:list_id"
do
authorize!
(
:admin_list
,
user_project
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录