feat: Renommage de GetManga à GetMangaById + ajout de axios

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-02-12 16:41:11 +01:00
parent 666636e5bf
commit 504c62c155
6 changed files with 34 additions and 26 deletions

View File

@@ -4,19 +4,19 @@ namespace App\Domain\Manga\Infrastructure\ApiPlatform\State\Provider;
use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProviderInterface;
use App\Domain\Manga\Application\Query\GetManga;
use App\Domain\Manga\Application\QueryHandler\GetMangaHandler;
use App\Domain\Manga\Application\Query\GetMangaById;
use App\Domain\Manga\Application\QueryHandler\GetMangaByIdHandler;
use App\Domain\Manga\Infrastructure\ApiPlatform\Dto\MangaDetail;
readonly class GetMangaStateProvider implements ProviderInterface
{
public function __construct(
private GetMangaHandler $handler
private GetMangaByIdHandler $handler
) {}
public function provide(Operation $operation, array $uriVariables = [], array $context = []): MangaDetail
{
$query = new GetManga($uriVariables['id']);
$query = new GetMangaById($uriVariables['id']);
$response = $this->handler->handle($query);
return new MangaDetail(
@@ -33,4 +33,4 @@ readonly class GetMangaStateProvider implements ProviderInterface
rating: $response->rating
);
}
}
}