feat: Reader beginning
This commit is contained in:
parent
e90c0a140e
commit
55945adc53
@@ -3,6 +3,7 @@
|
||||
namespace App\Domain\Scraping\Application\CommandHandler;
|
||||
|
||||
use App\Domain\Scraping\Application\Command\ScrapeChapter;
|
||||
use App\Domain\Scraping\Domain\Contract\Repository\ChapterRepositoryInterface;
|
||||
use App\Domain\Scraping\Domain\Contract\Repository\ScrapingJobRepositoryInterface;
|
||||
use App\Domain\Scraping\Domain\Contract\Service\ScraperInterface;
|
||||
use App\Domain\Scraping\Domain\Event\ChapterScraped;
|
||||
@@ -18,6 +19,7 @@ readonly class ScrapeChapterHandler
|
||||
public function __construct(
|
||||
private ScraperInterface $scraper,
|
||||
private ScrapingJobRepositoryInterface $scrapingJobRepository,
|
||||
private ChapterRepositoryInterface $chapterRepository,
|
||||
private MessageBusInterface $eventBus
|
||||
) {
|
||||
}
|
||||
@@ -42,6 +44,9 @@ readonly class ScrapeChapterHandler
|
||||
$this->eventBus->dispatch(new ChapterScrapingFailed($command->mangaId, $command->chapterNumber, $job->failureReason));
|
||||
}elseif ($job->status === ScrapingStatus::COMPLETED) {
|
||||
$this->eventBus->dispatch(new ChapterScraped($job->getId()));
|
||||
$chapter = $this->chapterRepository->getByMangaIdAndChapterNumber($command->mangaId, $command->chapterNumber);
|
||||
$chapter->cbzPath = $job->cbzPath->getPath();
|
||||
$this->chapterRepository->save($chapter);
|
||||
}
|
||||
|
||||
$this->scrapingJobRepository->save($job);
|
||||
|
||||
Reference in New Issue
Block a user