added 400 error for API BuildLists#create action
This commit is contained in:
parent
32dca22298
commit
0841c4d705
|
@ -14,12 +14,15 @@ class Api::V1::BuildListsController < Api::V1::BaseController
|
|||
end
|
||||
|
||||
def create
|
||||
project = Project.find(params[:build_list][:project_id])
|
||||
save_to_repository = Repository.find params[:build_list][:save_to_repository_id] #FIXME
|
||||
params[:build_list][:save_to_platform_id] = save_to_repository.platform_id
|
||||
params[:build_list][:auto_publish] = false unless save_to_repository.publish_without_qa?
|
||||
bl_params = params[:build_list] || {}
|
||||
project = Project.where(:id => bl_params[:project_id]).first
|
||||
save_to_repository = Repository.where(:id => bl_params[:save_to_repository_id]).first
|
||||
|
||||
@build_list = project.build_lists.build(params[:build_list])
|
||||
if project && save_to_repository
|
||||
bl_params[:save_to_platform_id] = save_to_repository.platform_id
|
||||
bl_params[:auto_publish] = false unless save_to_repository.publish_without_qa?
|
||||
|
||||
@build_list = project.build_lists.build(bl_params)
|
||||
@build_list.project_version = @build_list.commit_hash
|
||||
|
||||
@build_list.user = current_user
|
||||
|
@ -30,6 +33,9 @@ class Api::V1::BuildListsController < Api::V1::BaseController
|
|||
else
|
||||
render :json => {:message => "Validation Failed", :errors => @build_list.errors.messages}.to_json, :status => 422
|
||||
end
|
||||
else
|
||||
render :json => {:message => "Bad Request"}.to_json, :status => 400
|
||||
end
|
||||
end
|
||||
|
||||
def cancel
|
||||
|
|
Loading…
Reference in New Issue