feat: search results
This commit is contained in:
@@ -2,7 +2,24 @@
|
||||
|
||||
namespace App\Search\Action\Handler;
|
||||
|
||||
class SearchHandler
|
||||
{
|
||||
use App\Search\Action\Result\SearchResult;
|
||||
use App\Tmdb\Tmdb;
|
||||
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||
use OneToMany\RichBundle\Contract\HandlerInterface;
|
||||
use OneToMany\RichBundle\Contract\ResultInterface;
|
||||
|
||||
}
|
||||
class SearchHandler implements HandlerInterface
|
||||
{
|
||||
public function __construct(
|
||||
private Tmdb $tmdb,
|
||||
) {}
|
||||
|
||||
/*** @implements HandlerInterface<SearchResult> */
|
||||
public function handle(CommandInterface $command): ResultInterface
|
||||
{
|
||||
return new SearchResult(
|
||||
term: $command->term,
|
||||
results: $this->tmdb->search($command->term)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user