Expose ETag on single object get methods

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-08-29 12:01:46 +02:00
parent 082b7c1983
commit 8b7a30ce4f
6 changed files with 21 additions and 3 deletions

View File

@@ -85,7 +85,9 @@ class BoardApiController extends ApiController {
*/ */
public function get() { public function get() {
$board = $this->boardService->find($this->request->getParam('boardId')); $board = $this->boardService->find($this->request->getParam('boardId'));
return new DataResponse($board, HTTP::STATUS_OK); $response = new DataResponse($board, HTTP::STATUS_OK);
$response->setETag($board->getEtag());
return $response;
} }
/** /**

View File

@@ -64,7 +64,9 @@ class CardApiController extends ApiController {
*/ */
public function get() { public function get() {
$card = $this->cardService->find($this->request->getParam('cardId')); $card = $this->cardService->find($this->request->getParam('cardId'));
return new DataResponse($card, HTTP::STATUS_OK); $response = new DataResponse($card, HTTP::STATUS_OK);
$response->setETag($card->getEtag());
return $response;
} }
/** /**

View File

@@ -83,7 +83,9 @@ class StackApiController extends ApiController {
*/ */
public function get() { public function get() {
$stack = $this->stackService->find($this->request->getParam('stackId')); $stack = $this->stackService->find($this->request->getParam('stackId'));
return new DataResponse($stack, HTTP::STATUS_OK); $response = new DataResponse($stack, HTTP::STATUS_OK);
$response->setETag($stack->getETag());
return $response;
} }
/** /**

View File

@@ -81,4 +81,8 @@ class Board extends RelationalEntity {
$this->acl[] = $a; $this->acl[] = $a;
} }
} }
public function getETag() {
return md5((string)$this->getLastModified());
}
} }

View File

@@ -155,4 +155,8 @@ class Card extends RelationalEntity {
public function getCalendarPrefix(): string { public function getCalendarPrefix(): string {
return 'card'; return 'card';
} }
public function getETag() {
return md5((string)$this->getLastModified());
}
} }

View File

@@ -65,4 +65,8 @@ class Stack extends RelationalEntity {
public function getCalendarPrefix(): string { public function getCalendarPrefix(): string {
return 'stack'; return 'stack';
} }
public function getETag() {
return md5((string)$this->getLastModified());
}
} }