From d00d1ab2a28f428223e52b17052c072c64784016 Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Sat, 29 Aug 2020 23:39:35 +0200 Subject: Create V2 mapper, Service and management commands Signed-off-by: Sean Molenaar --- lib/Command/Updater/UpdateFeed.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'lib/Command/Updater/UpdateFeed.php') diff --git a/lib/Command/Updater/UpdateFeed.php b/lib/Command/Updater/UpdateFeed.php index f5cda22ad..5078e92a4 100644 --- a/lib/Command/Updater/UpdateFeed.php +++ b/lib/Command/Updater/UpdateFeed.php @@ -13,6 +13,7 @@ namespace OCA\News\Command\Updater; use Exception; +use OCA\News\Service\FeedServiceV2; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -22,9 +23,12 @@ use OCA\News\Service\FeedService; class UpdateFeed extends Command { + /** + * @var FeedServiceV2 Feed service + */ private $feedService; - public function __construct(FeedService $feedService) + public function __construct(FeedServiceV2 $feedService) { parent::__construct(); $this->feedService = $feedService; @@ -34,24 +38,25 @@ class UpdateFeed extends Command { $this->setName('news:updater:update-feed') ->addArgument( - 'feed-id', + 'user-id', InputArgument::REQUIRED, - 'feed id, integer' + 'user id of a user, string' ) ->addArgument( - 'user-id', + 'feed-id', InputArgument::REQUIRED, - 'user id of a user, string' + 'feed id, integer' ) ->setDescription('Console API for updating a single user\'s feed'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $feedId = $input->getArgument('feed-id'); $userId = $input->getArgument('user-id'); try { - $this->feedService->update($feedId, $userId); + $feed = $this->feedService->findForUser($userId, $feedId); + $this->feedService->fetch($feed); } catch (Exception $e) { $output->writeln( 'Could not update feed with id ' . $feedId . @@ -59,5 +64,7 @@ class UpdateFeed extends Command ' ' ); } + + return 0; } } -- cgit v1.2.3