Merge pull request #1641 from opf/feature/api-create-and-delete-relationship

Feature/api create and delete relationship
pull/1755/head
Alex Coles 10 years ago
commit 632441035b
  1. 6
      lib/api/v3/relations/relations_api.rb

@ -19,10 +19,9 @@ module API
r.delay = declared_params[:delay_id]
end
if relation.valid?
if relation.valid? && relation.save
model = ::API::V3::WorkPackages::RelationModel.new(relation)
representer = ::API::V3::WorkPackages::RelationRepresenter.new(model, work_package: relation.to)
relation.save!
representer
else
fail Errors::Validation.new(relation)
@ -32,8 +31,7 @@ module API
namespace ':relation_id' do
delete do
authorize(:manage_work_package_relations, context: @work_package.project)
relation = Relation.find(params[:relation_id])
relation.delete
Relation.destroy(params[:id])
status 204
end
end

Loading…
Cancel
Save