API: create merge request
This commit is contained in:
parent
bd049e5e7c
commit
fe59547ae5
|
@ -18,7 +18,17 @@ module Gitlab
|
|||
|
||||
#create merge_request
|
||||
post ":id/merge_requests" do
|
||||
|
||||
attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title]
|
||||
project = current_user.projects.find(params[:id])
|
||||
merge_request = project.merge_requests.new(attrs)
|
||||
merge_request.author = current_user
|
||||
|
||||
if merge_request.save
|
||||
merge_request.reload_code
|
||||
present merge_request, with: Entities::MergeRequest
|
||||
else
|
||||
not_found!
|
||||
end
|
||||
end
|
||||
|
||||
#update merge_request
|
||||
|
|
Loading…
Reference in New Issue