fix: Use episode action repository directly on controller

This commit is contained in:
Michel Roux 2024-01-13 00:09:11 +01:00
parent b2f2a96f2b
commit 7375088700

View File

@ -4,9 +4,11 @@ declare(strict_types=1);
namespace OCA\RePod\Controller;
use OCA\GPodderSync\Db\EpisodeAction\EpisodeActionRepository;
use OCA\RePod\AppInfo\Application;
use OCA\RePod\Core\EpisodeAction\EpisodeActionExtraData;
use OCA\RePod\Core\EpisodeAction\EpisodeActionReader;
use OCA\RePod\Service\UserService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
@ -18,7 +20,9 @@ class EpisodesController extends Controller
public function __construct(
IRequest $request,
private IClientService $clientService,
private EpisodeActionReader $episodeActionReader
private EpisodeActionReader $episodeActionReader,
private EpisodeActionRepository $episodeActionRepository,
private UserService $userService
) {
parent::__construct(Application::APP_ID, $request);
}
@ -36,7 +40,7 @@ class EpisodesController extends Controller
}
public function action(string $url): JSONResponse {
$action = $this->episodeActionReader->findByEpisodeUrl($url);
$action = $this->episodeActionRepository->findByEpisodeUrl($url, $this->userService->getUserUID());
if ($action) {
return new JSONResponse($action->toArray());