Prepare WorkPackagesByProject for form endpoint

pull/3125/head
Alexander Bach 10 years ago committed by Jens Ulferts
parent 59a539609d
commit 2aa4359fba
  1. 13
      lib/api/v3/work_packages/work_packages_by_project_api.rb

@ -37,19 +37,20 @@ module API
authorize(:view_project, context: @project) do
raise API::Errors::NotFound.new
end
@create_service = CreateWorkPackageService.new(
user: current_user,
project: @project,
send_notifications: !(params.has_key?(:notify) && params[:notify] == 'false'))
@work_package = @create_service.create
end
helpers ::API::V3::WorkPackages::WorkPackagesSharedHelpers
post do
create_service = CreateWorkPackageService.new(
user: current_user,
project: @project,
send_notifications: !(params.has_key?(:notify) && params[:notify] == 'false'))
@work_package = create_service.create
write_work_package_attributes
if write_request_valid?(WorkPackages::CreateContract) && create_service.save
if write_request_valid?(WorkPackages::CreateContract) && @create_service.save
@work_package.reload
WorkPackages::WorkPackageRepresenter.create(@work_package,

Loading…
Cancel
Save