feat: ajout de la fonctionnalité de suppression de mangas, incluant une modale de confirmation pour l'utilisateur, la gestion des erreurs et l'intégration avec l'API pour supprimer les mangas et leurs chapitres associés. Mise à jour des composants Vue et ajout de tests pour valider cette nouvelle fonctionnalité.
This commit is contained in:
parent
7f9d583c94
commit
f09f744a9b
@@ -5,17 +5,26 @@ namespace App\Domain\Scraping\Infrastructure\EventListener;
|
||||
use App\Domain\Manga\Domain\Event\ChapterReadyForScraping;
|
||||
use App\Domain\Scraping\Application\Command\ScrapeChapter;
|
||||
use App\Domain\Scraping\Application\CommandHandler\ScrapeChapterHandler;
|
||||
use App\Domain\Scraping\Domain\Contract\Repository\ChapterRepositoryInterface;
|
||||
use App\Domain\Scraping\Domain\Contract\Repository\MangaRepositoryInterface;
|
||||
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
|
||||
|
||||
class AutoScrapingListener
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ScrapeChapterHandler $scrapeChapterHandler
|
||||
private readonly ScrapeChapterHandler $scrapeChapterHandler,
|
||||
private readonly ChapterRepositoryInterface $chapterRepository,
|
||||
private readonly MangaRepositoryInterface $mangaRepository,
|
||||
) {}
|
||||
|
||||
#[AsMessageHandler]
|
||||
public function onChapterReadyForScraping(ChapterReadyForScraping $event): void
|
||||
{
|
||||
$this->scrapeChapterHandler->handle(new ScrapeChapter($event->chapterId->getValue()));
|
||||
$chapter = $this->chapterRepository->getById($event->chapterId->getValue());
|
||||
$manga = $this->mangaRepository->getById($chapter->mangaId);
|
||||
|
||||
if ($manga->isMonitored()) {
|
||||
$this->scrapeChapterHandler->handle(new ScrapeChapter($event->chapterId->getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,14 +35,15 @@ readonly class LegacyMangaRepository implements MangaRepositoryInterface
|
||||
}
|
||||
|
||||
return new Manga(
|
||||
(string) $mangaEntity->getId(),
|
||||
$mangaEntity->getTitle(),
|
||||
$mangaEntity->getSlug(),
|
||||
$mangaEntity->getDescription() ?? '',
|
||||
$mangaEntity->getAuthor() ?? '',
|
||||
(string) ($mangaEntity->getPublicationYear() ?? ''),
|
||||
$preferredSourceIds,
|
||||
$mangaEntity->getAlternativeSlugs() ?? []
|
||||
id: (string) $mangaEntity->getId(),
|
||||
title: $mangaEntity->getTitle(),
|
||||
slug: $mangaEntity->getSlug(),
|
||||
description: $mangaEntity->getDescription() ?? '',
|
||||
author: $mangaEntity->getAuthor() ?? '',
|
||||
publicationYear: (string) ($mangaEntity->getPublicationYear() ?? ''),
|
||||
monitored: $mangaEntity->isMonitored() ?? false,
|
||||
preferredSources: $preferredSourceIds,
|
||||
alternativeSlugs: $mangaEntity->getAlternativeSlugs() ?? []
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user