feat: ajout de la fonctionnalité de suppression des chapitres avec mise à jour de l'API et des composants associés pour gérer la suppression des chapitres et des fichiers CBZ.
This commit is contained in:
parent
37e1b202c2
commit
8692fa14c6
@@ -7,6 +7,8 @@ use App\Domain\Manga\Domain\Contract\Repository\ChapterRepositoryInterface;
|
||||
use App\Domain\Manga\Domain\Contract\Service\FileServiceInterface;
|
||||
use App\Domain\Manga\Domain\Exception\ChapterNotFoundException;
|
||||
use App\Domain\Manga\Domain\Exception\CbzFileNotFoundException;
|
||||
use App\Domain\Manga\Domain\Model\Chapter;
|
||||
use App\Domain\Manga\Domain\Model\ValueObject\ChapterId;
|
||||
use App\Domain\Shared\Domain\Contract\CommandHandlerInterface;
|
||||
use App\Domain\Shared\Domain\Contract\CommandInterface;
|
||||
|
||||
@@ -37,14 +39,14 @@ readonly class DeleteCbzHandler implements CommandHandlerInterface
|
||||
// For now, we'll just mark the chapter as not available
|
||||
|
||||
// Update chapter to mark CBZ as not available
|
||||
$updatedChapter = new \App\Domain\Manga\Domain\Model\Chapter(
|
||||
new \App\Domain\Manga\Domain\Model\ValueObject\ChapterId($chapter->getId()),
|
||||
$updatedChapter = new Chapter(
|
||||
new ChapterId($chapter->getId()),
|
||||
$chapter->getMangaId(),
|
||||
$chapter->getNumber(),
|
||||
$chapter->getTitle(),
|
||||
$chapter->getVolume(),
|
||||
$chapter->isVisible(),
|
||||
false, // isAvailable = false (CBZ removed)
|
||||
null,
|
||||
$chapter->getCreatedAt()
|
||||
);
|
||||
|
||||
|
||||
@@ -41,11 +41,11 @@ readonly class DownloadChapterHandler
|
||||
$preferredSources = $manga->getPreferredSources()->toArray();
|
||||
$allSources = $this->contentSourceRepository->findAll();
|
||||
|
||||
// $filteredSources = array_udiff($allSources, $preferredSources, function ($a, $b) {
|
||||
// return $a->getId() - $b->getId();
|
||||
// });
|
||||
//
|
||||
// $sources = array_merge($preferredSources, $filteredSources);
|
||||
$filteredSources = array_udiff($allSources, $preferredSources, function ($a, $b) {
|
||||
return $a->getId() - $b->getId();
|
||||
});
|
||||
|
||||
$sources = array_merge($preferredSources, $filteredSources);
|
||||
|
||||
if (count($preferredSources) > 0) {
|
||||
$sources = $preferredSources;
|
||||
@@ -53,12 +53,12 @@ readonly class DownloadChapterHandler
|
||||
$sources = $allSources;
|
||||
}
|
||||
|
||||
$sources[] =
|
||||
(new ContentSource())
|
||||
->setBaseUrl('https://api.mangadex.org/')
|
||||
->setImageSelector('img')
|
||||
->setChapterUrlFormat('at-home/server/%s')
|
||||
->setScrapingType('mangadex');
|
||||
// $sources[] =
|
||||
// (new ContentSource())
|
||||
// ->setBaseUrl('https://api.mangadex.org/')
|
||||
// ->setImageSelector('img')
|
||||
// ->setChapterUrlFormat('at-home/server/%s')
|
||||
// ->setScrapingType('mangadex');
|
||||
|
||||
// (new ContentSource())
|
||||
// ->setBaseUrl('https://lelscans.net')
|
||||
|
||||
Reference in New Issue
Block a user