Commit 876bf723 authored by Jarka Kadlecová's avatar Jarka Kadlecová

Update update epic API endpoint response

parent 2cedef01
...@@ -312,3 +312,100 @@ Example response: ...@@ -312,3 +312,100 @@ Example response:
``` ```
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API. **Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
## Update epic - issue association
Updates an epic - issue association.
```
PUT /groups/:id/-/epics/:epic_iid/issues/:epic_issue_id
```
| Attribute | Type | Required | Description |
| ------------------- | ---------------- | ---------- | -----------------------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
| `epic_iid` | integer/string | yes | The internal ID of the epic. |
| `epic_issue_id` | integer/string | yes | The ID of the issue - epic association. |
| `move_before_id` | integer/string | no | The ID of the issue - epic association that should be placed before the link in the question. |
| `move_after_id` | integer/string | no | The ID of the issue - epic association that should be placed after the link in the question. |
```bash
curl --header PUT "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/groups/1/-/epics/5/issues/11?move_before_id=20
```
Example response:
```json
[
{
"id": 30,
"iid": 6,
"project_id": 8,
"title" : "Consequatur vero maxime deserunt laboriosam est voluptas dolorem.",
"description" : "Ratione dolores corrupti mollitia soluta quia.",
"state": "opened",
"created_at": "2017-11-15T13:39:24.670Z",
"updated_at": "2018-01-04T10:49:19.506Z",
"closed_at": null,
"labels": [],
"milestone": {
"id": 38,
"iid": 3,
"project_id": 8,
"title": "v2.0",
"description": "In tempore culpa inventore quo accusantium.",
"state": "closed",
"created_at": "2017-11-15T13:39:13.825Z",
"updated_at": "2017-11-15T13:39:13.825Z",
"due_date": null,
"start_date": null
},
"assignees": [{
"id": 7,
"name": "Pamella Huel",
"username": "arnita",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
"web_url": "http://localhost:3001/arnita"
}],
"assignee": {
"id": 7,
"name": "Pamella Huel",
"username": "arnita",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
"web_url": "http://localhost:3001/arnita"
},
"author": {
"id": 13,
"name": "Michell Johns",
"username": "chris_hahn",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/30e3b2122ccd6b8e45e8e14a3ffb58fc?s=80&d=identicon",
"web_url": "http://localhost:3001/chris_hahn"
},
"user_notes_count": 8,
"upvotes": 0,
"downvotes": 0,
"due_date": null,
"confidential": false,
"weight": null,
"discussion_locked": null,
"web_url": "http://localhost:3001/h5bp/html5-boilerplate/issues/6",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"_links":{
"self": "http://localhost:3001/api/v4/projects/8/issues/6",
"notes": "http://localhost:3001/api/v4/projects/8/issues/6/notes",
"award_emoji": "http://localhost:3001/api/v4/projects/8/issues/6/award_emoji",
"project": "http://localhost:3001/api/v4/projects/8"
},
"subscribed": true,
"epic_issue_id": 11,
"relative_position": 55
}
]
...@@ -52,7 +52,13 @@ module API ...@@ -52,7 +52,13 @@ module API
# For now we return empty body # For now we return empty body
# The issues list in the correct order in body will be returned as part of #4250 # The issues list in the correct order in body will be returned as part of #4250
render_api_error!({ error: "Issue could not be moved!" }, 400) unless result if result
present epic.issues(current_user),
with: Entities::EpicIssue,
current_user: current_user
else
render_api_error!({ error: "Issue could not be moved!" }, 400)
end
end end
desc 'Get issues assigned to the epic' do desc 'Get issues assigned to the epic' do
......
...@@ -503,10 +503,12 @@ module API ...@@ -503,10 +503,12 @@ module API
class EpicIssue < Issue class EpicIssue < Issue
expose :epic_issue_id expose :epic_issue_id
expose :relative_position
end end
class EpicIssueLink < Grape::Entity class EpicIssueLink < Grape::Entity
expose :id expose :id
expose :relative_position
expose :epic, using: Entities::Epic expose :epic, using: Entities::Epic
expose :issue, using: Entities::IssueBasic expose :issue, using: Entities::IssueBasic
end end
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"type": "object", "type": "object",
"properties" : { "properties" : {
"id": { "type": "integer" }, "id": { "type": "integer" },
"relative_position": { "type": "integer" },
"issue": { "type": "object" }, "issue": { "type": "object" },
"epic": { "epic": {
"type": "object", "type": "object",
...@@ -32,6 +33,6 @@ ...@@ -32,6 +33,6 @@
] ]
} }
}, },
"required" : [ "id", "epic", "issue" ], "required" : [ "id", "epic", "issue", "relative_position" ],
"additionalProperties": false "additionalProperties": false
} }
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
{ "$ref": "./issues.json" }, { "$ref": "./issues.json" },
{ {
"properties": { "properties": {
"issue_link_id": { "type": ["integer", "null"] }, "epic_issue_id": { "type": ["integer"] },
"position": { "type": ["integer", "null"] } "relative_position": { "type": ["integer"] }
} }
} }
] ],
"additionalProperties": false
} }
...@@ -295,8 +295,11 @@ describe API::EpicIssues do ...@@ -295,8 +295,11 @@ describe API::EpicIssues do
it 'updates the positions values' do it 'updates the positions values' do
expect(epic_issue1.reload.relative_position).to be < epic_issue2.relative_position expect(epic_issue1.reload.relative_position).to be < epic_issue2.relative_position
end end
it 'matches the response schema' do
expect(response).to match_response_schema('public_api/v4/epic_issues', dir: 'ee')
end
end end
end end
end end
end end
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