From 115df4b9e2fec28449d7f6c2a10ed2633b5f062b Mon Sep 17 00:00:00 2001 From: Paul Tirk Date: Mon, 11 Apr 2022 15:53:44 +0000 Subject: remove duplicate function Signed-off-by: Paul Tirk --- lib/Controller/ItemApiController.php | 2 +- lib/Service/ItemServiceV2.php | 26 ------------------------- tests/Unit/Controller/ItemApiControllerTest.php | 4 ++-- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/lib/Controller/ItemApiController.php b/lib/Controller/ItemApiController.php index cf6266006..9b8090ef7 100644 --- a/lib/Controller/ItemApiController.php +++ b/lib/Controller/ItemApiController.php @@ -231,7 +231,7 @@ class ItemApiController extends ApiController private function setStarredByItemId(int $itemId, bool $isStarred) { try { - $this->itemService->starByItemId($this->getUserId(), $itemId, $isStarred); + $this->itemService->star($this->getUserId(), $itemId, $isStarred); } catch (ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } diff --git a/lib/Service/ItemServiceV2.php b/lib/Service/ItemServiceV2.php index 4f314105b..57804a8c3 100644 --- a/lib/Service/ItemServiceV2.php +++ b/lib/Service/ItemServiceV2.php @@ -211,32 +211,6 @@ class ItemServiceV2 extends Service return $this->mapper->update($item); } - /** - * Mark an item as starred by id - * - * @param string $userId Item owner - * @param int $itemId - * @param bool $starred - * - * @return Item - * @throws ServiceConflictException - * @throws ServiceNotFoundException - */ - public function starByItemId(string $userId, int $itemId, bool $starred): Entity - { - try { - $item = $this->mapper->findFromUser($userId, $itemId); - } catch (DoesNotExistException $ex) { - throw ServiceNotFoundException::from($ex); - } catch (MultipleObjectsReturnedException $ex) { - throw ServiceConflictException::from($ex); - } - - $item->setStarred($starred); - - return $this->mapper->update($item); - } - /** * Mark all items as read * diff --git a/tests/Unit/Controller/ItemApiControllerTest.php b/tests/Unit/Controller/ItemApiControllerTest.php index b65b1245f..749bb2d98 100644 --- a/tests/Unit/Controller/ItemApiControllerTest.php +++ b/tests/Unit/Controller/ItemApiControllerTest.php @@ -502,7 +502,7 @@ class ItemApiControllerTest extends TestCase public function testStarByItemId() { $this->itemService->expects($this->once()) - ->method('starByItemId') + ->method('star') ->with($this->uid, 123, true); $this->class->starByItemId(123); @@ -512,7 +512,7 @@ class ItemApiControllerTest extends TestCase public function testUnstarByItemId() { $this->itemService->expects($this->once()) - ->method('starByItemId') + ->method('star') ->with($this->uid, 123, false); $this->class->unstarByItemId(123); -- cgit v1.2.3