Commit 12800e54 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Extend API Issues, MergeRequets, Milestones with iid field

parent ace9ff4a
......@@ -91,15 +91,16 @@ module API
expose :expires_at, :updated_at, :created_at
end
class Milestone < Grape::Entity
expose :id
expose (:project_id) {|milestone| milestone.project.id}
class ProjectEntity < Grape::Entity
expose :id, :iid
expose (:project_id) { |entity| entity.project.id }
end
class Milestone < ProjectEntity
expose :title, :description, :due_date, :state, :updated_at, :created_at
end
class Issue < Grape::Entity
expose :id
expose (:project_id) {|issue| issue.project.id}
class Issue < ProjectEntity
expose :title, :description
expose :label_list, as: :labels
expose :milestone, using: Entities::Milestone
......@@ -107,14 +108,14 @@ module API
expose :state, :updated_at, :created_at
end
class SSHKey < Grape::Entity
expose :id, :title, :key, :created_at
class MergeRequest < ProjectEntity
expose :target_branch, :source_branch, :title, :state, :upvotes, :downvotes
expose :author, :assignee, using: Entities::UserBasic
expose :source_project_id, :target_project_id
end
class MergeRequest < Grape::Entity
expose :id, :target_branch, :source_branch, :title, :state, :upvotes, :downvotes
expose :target_project_id, as: :project_id
expose :author, :assignee, using: Entities::UserBasic
class SSHKey < Grape::Entity
expose :id, :title, :key, :created_at
end
class Note < Grape::Entity
......
......@@ -42,6 +42,7 @@ describe API::API do
get api("/projects/#{project.id}/issues/#{issue.id}", user)
response.status.should == 200
json_response['title'].should == issue.title
json_response['iid'].should == issue.iid
end
it "should return 404 if issue id not found" do
......
......@@ -34,6 +34,7 @@ describe API::API do
get api("/projects/#{project.id}/merge_request/#{merge_request.id}", user)
response.status.should == 200
json_response['title'].should == merge_request.title
json_response['iid'].should == merge_request.iid
end
it "should return a 404 error if merge_request_id not found" do
......
......@@ -30,6 +30,7 @@ describe API::API do
get api("/projects/#{project.id}/milestones/#{milestone.id}", user)
response.status.should == 200
json_response['title'].should == milestone.title
json_response['iid'].should == milestone.iid
end
it "should return 401 error if user not authenticated" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment