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
@@ -24,7 +24,7 @@ readonly class CreateMangaFromMangadexHandler
|
||||
public function handle(CreateMangaFromMangadex $command): void
|
||||
{
|
||||
$manga = $this->mangaProvider->findByExternalId(new ExternalId($command->externalId));
|
||||
|
||||
|
||||
if ($manga === null) {
|
||||
throw new MangaNotFoundException('Manga not found on Mangadex');
|
||||
}
|
||||
@@ -32,10 +32,10 @@ readonly class CreateMangaFromMangadexHandler
|
||||
try {
|
||||
// Télécharge l'image originale
|
||||
$fullImagePath = $this->imageProcessor->downloadImage($manga->getImageUrl());
|
||||
|
||||
|
||||
// Crée la miniature à partir de l'image originale
|
||||
$thumbnailPath = $this->imageProcessor->createThumbnail($fullImagePath);
|
||||
|
||||
|
||||
// Met à jour le manga avec les nouveaux chemins d'images
|
||||
$manga->updateImageUrls(new ImageUrls($fullImagePath, $thumbnailPath));
|
||||
} catch (\Exception $e) {
|
||||
@@ -43,7 +43,7 @@ readonly class CreateMangaFromMangadexHandler
|
||||
}
|
||||
|
||||
$this->mangaRepository->save($manga);
|
||||
|
||||
$this->messageBus->dispatch(new MangaCreated($command->externalId));
|
||||
|
||||
$this->messageBus->dispatch(new MangaCreated($manga->getId()->getValue(), $command->externalId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user