feat: ajout de la fonctionnalité de récupération des chapitres de manga, avec mise à jour de l'API et des composants pour gérer la récupération asynchrone des chapitres, ainsi que des améliorations dans la gestion des erreurs et des tests associés.
This commit is contained in:
parent
5a5569cf2c
commit
ee2a9b3750
@@ -19,12 +19,18 @@ readonly class FetchMangaChaptersHandler
|
||||
|
||||
public function handle(FetchMangaChapters $command): void
|
||||
{
|
||||
$manga = $this->mangaRepository->findByExternalId(new ExternalId($command->externalId));
|
||||
$manga = $this->mangaRepository->findById($command->mangaId);
|
||||
|
||||
if ($manga === null) {
|
||||
throw new \RuntimeException('Manga not found');
|
||||
}
|
||||
|
||||
if ($manga->getExternalId() === null) {
|
||||
throw new \RuntimeException('Manga has no external ID');
|
||||
}
|
||||
|
||||
$externalId = $manga->getExternalId()->getValue();
|
||||
|
||||
$offset = 0;
|
||||
$limit = 500;
|
||||
$hasMore = true;
|
||||
@@ -34,7 +40,7 @@ readonly class FetchMangaChaptersHandler
|
||||
|
||||
while ($hasMore) {
|
||||
$feed = $this->mangadexClient->getMangaFeed(
|
||||
$command->externalId,
|
||||
$externalId,
|
||||
$offset,
|
||||
$limit
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user