Draft new work package create endpoints

pull/3125/head
Alexander Bach 10 years ago committed by Jens Ulferts
parent bd9520d964
commit 8d152e0245
  1. 14
      lib/api/v3/projects/project_representer.rb
  2. 2
      lib/api/v3/projects/projects_api.rb
  3. 8
      lib/api/v3/utilities/path_helper.rb

@ -37,6 +37,20 @@ module API
self_link
link :createWorkPackage do
{
href: api_v3_paths.work_packages_by_project(represented.id),
method: :post
} if current_user_allowed_to(:add_work_packages, context: represented)
end
link :createWorkPackageImmediate do
{
href: api_v3_paths.create_work_package_form(represented.id),
method: :post
} if current_user_allowed_to(:add_work_packages, context: represented)
end
link 'categories' do
{ href: api_v3_paths.categories(represented.id) }
end

@ -47,7 +47,7 @@ module API
end
get do
ProjectRepresenter.new(@project)
ProjectRepresenter.new(@project, current_user: current_user)
end
mount API::V3::Projects::AvailableAssigneesAPI

@ -74,6 +74,10 @@ module API
"#{root}/categories/#{id}"
end
def self.create_work_package_form(project_id)
"#{project(project_id)}/work_packages/form"
end
def self.priorities
"#{root}/priorities"
end
@ -200,6 +204,10 @@ module API
"#{work_package(id)}/watchers"
end
def self.work_packages_by_project(project_id)
"#{project(project_id)}/work_packages"
end
def self.root_path
@@root_path ||= Class.new.tap do |c|
c.extend(::API::V3::Utilities::PathHelper)

Loading…
Cancel
Save