fix-feat: ajax download call
This commit is contained in:
@@ -7,6 +7,7 @@ use OneToMany\RichBundle\Contract\CommandInterface;
|
||||
class GetMovieOptionsCommand implements CommandInterface
|
||||
{
|
||||
public function __construct(
|
||||
public string $tmdbId,
|
||||
public string $imdbId,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Torrentio\Action\Handler;
|
||||
|
||||
use App\Tmdb\Tmdb;
|
||||
use App\Torrentio\Action\Result\GetMovieOptionsResult;
|
||||
use App\Torrentio\Client\Torrentio;
|
||||
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||
@@ -11,13 +12,15 @@ use OneToMany\RichBundle\Contract\ResultInterface;
|
||||
class GetMovieOptionsHandler implements HandlerInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Tmdb $tmdb,
|
||||
private readonly Torrentio $torrentio,
|
||||
) {}
|
||||
|
||||
public function handle(CommandInterface $command): ResultInterface
|
||||
{
|
||||
return new GetMovieOptionsResult(
|
||||
results: $this->torrentio->search($command->imdbId, 'movies')
|
||||
media: $this->tmdb->mediaDetails($command->tmdbId, 'movies'),
|
||||
results: $this->torrentio->search($command->imdbId, 'movies'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,12 +10,15 @@ use OneToMany\RichBundle\Contract\InputInterface;
|
||||
class GetMovieOptionsInput implements InputInterface
|
||||
{
|
||||
public function __construct(
|
||||
#[SourceRoute('tmdbId')]
|
||||
public string $tmdbId,
|
||||
|
||||
#[SourceRoute('imdbId')]
|
||||
public string $imdbId,
|
||||
) {}
|
||||
|
||||
public function toCommand(): CommandInterface
|
||||
{
|
||||
return new GetMovieOptionsCommand($this->imdbId);
|
||||
return new GetMovieOptionsCommand($this->tmdbId, $this->imdbId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Torrentio\Action\Result;
|
||||
|
||||
use App\Tmdb\TmdbResult;
|
||||
use OneToMany\RichBundle\Contract\ResultInterface;
|
||||
|
||||
class GetMovieOptionsResult implements ResultInterface
|
||||
{
|
||||
public function __construct(
|
||||
public TmdbResult $media,
|
||||
public array $results
|
||||
) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user