diff options
author | Sean Molenaar <sean@seanmolenaar.eu> | 2021-01-02 17:57:17 +0100 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-02-13 13:22:57 +0100 |
commit | b4fa772bc5f23f84fc292f5d6bf884543d2bfe51 (patch) | |
tree | 8576ad3ea145f3644804e2fd93de462cfc2c2578 /lib/Controller/FeedController.php | |
parent | ceba81060303e49b2617397397f2804516052ec9 (diff) |
Remove V1 item API
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'lib/Controller/FeedController.php')
-rw-r--r-- | lib/Controller/FeedController.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Controller/FeedController.php b/lib/Controller/FeedController.php index 9f7c9b0d6..681dda4bc 100644 --- a/lib/Controller/FeedController.php +++ b/lib/Controller/FeedController.php @@ -18,12 +18,12 @@ use OCA\News\Service\Exceptions\ServiceNotFoundException; use OCA\News\Service\FeedServiceV2; use OCA\News\Service\FolderServiceV2; use OCA\News\Service\ImportService; +use OCA\News\Service\ItemServiceV2; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; use OCP\IConfig; use OCP\AppFramework\Http; -use OCA\News\Service\ItemService; use OCA\News\Db\FeedType; use OCP\IUserSession; @@ -35,7 +35,9 @@ class FeedController extends Controller * @var FeedServiceV2 */ private $feedService; - //TODO: Remove + /** + * @var ItemServiceV2 + */ private $itemService; /** * @var FolderServiceV2 @@ -54,7 +56,7 @@ class FeedController extends Controller IRequest $request, FolderServiceV2 $folderService, FeedServiceV2 $feedService, - ItemService $itemService, + ItemServiceV2 $itemService, ImportService $importService, IConfig $settings, ?IUserSession $userSession @@ -79,11 +81,11 @@ class FeedController extends Controller // item id which will be used for marking feeds read $params = [ 'feeds' => $this->feedService->findAllForUser($this->getUserId()), - 'starred' => $this->itemService->starredCount($this->getUserId()) + 'starred' => count($this->itemService->starred($this->getUserId())) ]; try { - $id = $this->itemService->getNewestItemId($this->getUserId()); + $id = $this->itemService->newest($this->getUserId())->getId(); // An exception occurs if there is a newest item. If there is none, // simply ignore it and do not add the newestItemId @@ -183,7 +185,7 @@ class FeedController extends Controller $this->feedService->fetch($feed); try { - $id = $this->itemService->getNewestItemId($this->getUserId()); + $id = $this->itemService->newest($this->getUserId())->getId(); // An exception occurs if there is a newest item. If there is none, // simply ignore it and do not add the newestItemId $params['newestItemId'] = $id; @@ -261,7 +263,7 @@ class FeedController extends Controller $feed = $this->importService->importArticles($this->getUserId(), $json); $params = [ - 'starred' => $this->itemService->starredCount($this->getUserId()) + 'starred' => count($this->itemService->starred($this->getUserId())) ]; if ($feed) { @@ -281,7 +283,7 @@ class FeedController extends Controller */ public function read(int $feedId, int $highestItemId): array { - $this->itemService->readFeed($feedId, $highestItemId, $this->getUserId()); + $this->feedService->read($this->getUserId(), $feedId, $highestItemId); return [ 'feeds' => [ |