feat: media result page
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Search\Action\Handler\GetMediaInfoHandler;
|
||||
use App\Search\Action\Handler\SearchHandler;
|
||||
use App\Search\Action\Input\GetMediaInfoInput;
|
||||
use App\Search\Action\Input\SearchInput;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -12,17 +14,30 @@ final class SearchController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private SearchHandler $searchHandler,
|
||||
private GetMediaInfoHandler $getMediaInfoHandler,
|
||||
) {}
|
||||
|
||||
#[Route('/search', name: 'app_search', methods: ['GET'])]
|
||||
public function index(
|
||||
public function search(
|
||||
SearchInput $searchInput,
|
||||
): Response
|
||||
{
|
||||
): Response {
|
||||
$results = $this->searchHandler->handle($searchInput->toCommand());
|
||||
|
||||
return $this->render('search/results.html.twig', [
|
||||
'results' => $results,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/result/{mediaType}/{tmdbId}', name: 'app_search_result')]
|
||||
public function result(
|
||||
GetMediaInfoInput $getDownloadOptionsInput,
|
||||
): Response {
|
||||
$result = $this->getMediaInfoHandler->handle(
|
||||
$getDownloadOptionsInput->toCommand()
|
||||
);
|
||||
|
||||
return $this->render('search/result.html.twig', [
|
||||
'result' => $result,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user