feat: button to add movie monitor

This commit is contained in:
2025-05-03 11:53:23 -05:00
parent babcb00440
commit 5688b3a0df
9 changed files with 166 additions and 7 deletions

View File

@@ -2,6 +2,9 @@
namespace App\Controller;
use App\Download\Action\Command\AddMovieMonitorCommand;
use App\Download\Action\Handler\AddMovieMonitorHandler;
use App\Download\Action\Input\AddMovieMonitorInput;
use App\Download\Action\Input\DownloadMediaInput;
use App\Download\Framework\Repository\DownloadRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -37,4 +40,16 @@ class DownloadController extends AbstractController
return $this->json(['status' => 200, 'message' => 'Added to Queue']);
}
#[Route('/monitor/movies/{tmdbId}/{imdbId}/{title}', name: 'app_add_movie_monitor', methods: ['GET', 'POST'])]
public function addMonitor(
AddMovieMonitorInput $input,
AddMovieMonitorHandler $handler,
) {
$handler->handle($input->toCommand());
return $this->json([
'status' => 200,
'message' => $input
]);
}
}

View File

@@ -37,8 +37,8 @@ final class SearchController extends AbstractController
): Response {
$cacheId = sprintf("page.%s.%s", $input->mediaType, $input->tmdbId);
return $cache->get($cacheId, function (ItemInterface $item) use ($input) {
$item->expiresAt(new \DateTimeImmutable("today 11:59 pm"));
// return $cache->get($cacheId, function (ItemInterface $item) use ($input) {
// $item->expiresAt(new \DateTimeImmutable("today 11:59 pm"));
$result = $this->getMediaInfoHandler->handle($input->toCommand());
return $this->render('search/result.html.twig', [
'results' => $result,
@@ -51,6 +51,6 @@ final class SearchController extends AbstractController
'episode' => ''
]
]);
});
// });
}
}