feat: media result page

This commit is contained in:
2025-04-21 11:30:18 -05:00
parent fb4b7dc71e
commit 77907601f8
24 changed files with 844 additions and 19 deletions

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Search\Action\Command;
use OneToMany\RichBundle\Contract\CommandInterface;
class GetMediaInfoCommand implements CommandInterface
{
/** @implements CommandInterface<GetMediaInfoCommand> */
public function __construct(
public string $tmdbId,
public string $mediaType,
) {}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Search\Action\Handler;
use App\Search\Action\Result\GetMediaInfoResult;
use App\Tmdb\Tmdb;
use OneToMany\RichBundle\Contract\CommandInterface;
use OneToMany\RichBundle\Contract\HandlerInterface;
use OneToMany\RichBundle\Contract\ResultInterface;
class GetMediaInfoHandler implements HandlerInterface
{
public function __construct(
private readonly Tmdb $tmdb,
) {}
public function handle(CommandInterface $command): ResultInterface
{
$media = $this->tmdb->mediaDetails($command->tmdbId, $command->mediaType);
return new GetMediaInfoResult($media);
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Search\Action\Input;
use App\Download\Action\Command\GetDownloadOptionsCommand;
use App\Search\Action\Command\GetMediaInfoCommand;
use OneToMany\RichBundle\Attribute\SourceRoute;
use OneToMany\RichBundle\Contract\CommandInterface;
use OneToMany\RichBundle\Contract\InputInterface;
class GetMediaInfoInput implements InputInterface
{
public function __construct(
#[SourceRoute('tmdbId')]
public string $tmdbId,
#[SourceRoute('mediaType')]
public string $mediaType,
) {}
public function toCommand(): CommandInterface
{
return new GetMediaInfoCommand($this->tmdbId, $this->mediaType);
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Search\Action\Result;
use App\Tmdb\TmdbResult;
use OneToMany\RichBundle\Contract\ResultInterface;
class GetMediaInfoResult implements ResultInterface
{
/** @implements ResultInterface<GetMediaInfoResult> */
public function __construct(
public TmdbResult $media,
) {}
}