Feat(REST API): add url to (un)archive cards
Signed-off-by: Jonas H. Steiner <jsteiner@plusline.net>
This commit is contained in:
committed by
Julius Härtl
parent
43a0fec9a6
commit
e986ca31a1
@@ -102,6 +102,8 @@ return [
|
|||||||
['name' => 'card_api#assignUser', 'url' => '/api/v{apiVersion}/boards/{boardId}/stacks/{stackId}/cards/{cardId}/assignUser', 'verb' => 'PUT'],
|
['name' => 'card_api#assignUser', 'url' => '/api/v{apiVersion}/boards/{boardId}/stacks/{stackId}/cards/{cardId}/assignUser', 'verb' => 'PUT'],
|
||||||
['name' => 'card_api#unassignUser', 'url' => '/api/v{apiVersion}/boards/{boardId}/stacks/{stackId}/cards/{cardId}/unassignUser', 'verb' => 'PUT'],
|
['name' => 'card_api#unassignUser', 'url' => '/api/v{apiVersion}/boards/{boardId}/stacks/{stackId}/cards/{cardId}/unassignUser', 'verb' => 'PUT'],
|
||||||
['name' => 'card_api#reorder', 'url' => '/api/v{apiVersion}/boards/{boardId}/stacks/{stackId}/cards/{cardId}/reorder', 'verb' => 'PUT'],
|
['name' => 'card_api#reorder', 'url' => '/api/v{apiVersion}/boards/{boardId}/stacks/{stackId}/cards/{cardId}/reorder', 'verb' => 'PUT'],
|
||||||
|
['name' => 'card_api#archive', 'url' => '/api/v{apiVersion}/boards/{boardId}/stacks/{stackId}/cards/{cardId}/archive', 'verb' => 'PUT'],
|
||||||
|
['name' => 'card_api#unarchive', 'url' => '/api/v{apiVersion}/boards/{boardId}/stacks/{stackId}/cards/{cardId}/unarchive', 'verb' => 'PUT'],
|
||||||
['name' => 'card_api#delete', 'url' => '/api/v{apiVersion}/boards/{boardId}/stacks/{stackId}/cards/{cardId}', 'verb' => 'DELETE'],
|
['name' => 'card_api#delete', 'url' => '/api/v{apiVersion}/boards/{boardId}/stacks/{stackId}/cards/{cardId}', 'verb' => 'DELETE'],
|
||||||
|
|
||||||
['name' => 'card_api#findAllWithDue', 'url' => '/api/v{apiVersion}/dashboard/due', 'verb' => 'GET'],
|
['name' => 'card_api#findAllWithDue', 'url' => '/api/v{apiVersion}/dashboard/due', 'verb' => 'GET'],
|
||||||
|
|||||||
28
docs/API.md
28
docs/API.md
@@ -347,6 +347,34 @@ A 403 response might be returned if the users ability to create new boards has b
|
|||||||
|
|
||||||
##### 200 Success
|
##### 200 Success
|
||||||
|
|
||||||
|
### PUT /boards/{boardId}/stacks/{stackId}/cards/{cardId}/archive - Archive a card
|
||||||
|
|
||||||
|
#### Request parameters
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
| --------- | ------- | --------------------------------------- |
|
||||||
|
| boardId | Integer | The id of the board the card belongs to |
|
||||||
|
| stackId | Integer | The id of the stack the card belongs to |
|
||||||
|
| cardId | Integer | The id of the card |
|
||||||
|
|
||||||
|
#### Response
|
||||||
|
|
||||||
|
##### 200 Success
|
||||||
|
|
||||||
|
### PUT /boards/{boardId}/stacks/{stackId}/cards/{cardId}/unarchive - Unarchive a card
|
||||||
|
|
||||||
|
#### Request parameters
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
| --------- | ------- | --------------------------------------- |
|
||||||
|
| boardId | Integer | The id of the board the card belongs to |
|
||||||
|
| stackId | Integer | The id of the stack the card belongs to |
|
||||||
|
| cardId | Integer | The id of the card |
|
||||||
|
|
||||||
|
#### Response
|
||||||
|
|
||||||
|
##### 200 Success
|
||||||
|
|
||||||
### DELETE /boards/{boardId} - Delete a board
|
### DELETE /boards/{boardId} - Delete a board
|
||||||
|
|
||||||
#### Request parameters
|
#### Request parameters
|
||||||
|
|||||||
@@ -152,6 +152,30 @@ class CardApiController extends ApiController {
|
|||||||
return new DataResponse($card, HTTP::STATUS_OK);
|
return new DataResponse($card, HTTP::STATUS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
* @CORS
|
||||||
|
* @NoCSRFRequired
|
||||||
|
*
|
||||||
|
* Archive card
|
||||||
|
*/
|
||||||
|
public function archive($cardId) {
|
||||||
|
$card = $this->cardService->archive($cardId);
|
||||||
|
return new DataResponse($card, HTTP::STATUS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
* @CORS
|
||||||
|
* @NoCSRFRequired
|
||||||
|
*
|
||||||
|
* Unarchive card
|
||||||
|
*/
|
||||||
|
public function unarchive($cardId) {
|
||||||
|
$card = $this->cardService->unarchive($cardId);
|
||||||
|
return new DataResponse($card, HTTP::STATUS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @CORS
|
* @CORS
|
||||||
|
|||||||
@@ -119,6 +119,32 @@ class CardApiControllerTest extends \Test\TestCase {
|
|||||||
$this->assertEquals($expected, $actual);
|
$this->assertEquals($expected, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testArchive() {
|
||||||
|
$card = new Card();
|
||||||
|
$card->setId($this->cardExample['id']);
|
||||||
|
|
||||||
|
$this->cardService->expects($this->once())
|
||||||
|
->method('archive')
|
||||||
|
->willReturn($card);
|
||||||
|
|
||||||
|
$expected = new DataResponse($card, HTTP::STATUS_OK);
|
||||||
|
$actual = $this->controller->archive($this->cardExample['id']);
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUnArchive() {
|
||||||
|
$card = new Card();
|
||||||
|
$card->setId($this->cardExample['id']);
|
||||||
|
|
||||||
|
$this->cardService->expects($this->once())
|
||||||
|
->method('unarchive')
|
||||||
|
->willReturn($card);
|
||||||
|
|
||||||
|
$expected = new DataResponse($card, HTTP::STATUS_OK);
|
||||||
|
$actual = $this->controller->unarchive($this->cardExample['id']);
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
public function testDelete() {
|
public function testDelete() {
|
||||||
$card = new Card();
|
$card = new Card();
|
||||||
$card->setId($this->cardExample['id']);
|
$card->setId($this->cardExample['id']);
|
||||||
|
|||||||
Reference in New Issue
Block a user