refactor(manga): merge ChapterRepositoryInterface into MangaRepositoryInterface + pagesDirectory
- Supprime ChapterRepositoryInterface du domaine Manga (et ses implémentations LegacyChapterRepository et InMemoryChapterRepository) - Déplace toutes les méthodes chapter vers MangaRepositoryInterface avec nommage explicite (findChapterById, findVisibleChapterById, updateChapter, deleteChapter, etc.) - Remplace cbzPath par pagesDirectory + pageCount dans le modèle Chapter (transition : toChapterDomain conserve un fallback cbzPath pour les données existantes, updateChapter synchronise les deux colonnes jusqu'à la Phase 4) - Ajoute la migration Doctrine (pages_directory, page_count sur la table chapter) - Met à jour tous les handlers, listeners, query handlers et state providers du domaine Manga pour injecter uniquement MangaRepositoryInterface - Adapte les tests unitaires et InMemoryMangaRepository avec les nouvelles méthodes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
dae215dd3d
commit
c50f1638ee
@@ -3,7 +3,7 @@
|
||||
namespace App\Domain\Manga\Application\CommandHandler;
|
||||
|
||||
use App\Domain\Manga\Application\Command\DeleteChapter;
|
||||
use App\Domain\Manga\Domain\Contract\Repository\ChapterRepositoryInterface;
|
||||
use App\Domain\Manga\Domain\Contract\Repository\MangaRepositoryInterface;
|
||||
use App\Domain\Manga\Domain\Exception\ChapterNotFoundException;
|
||||
use App\Domain\Manga\Domain\Model\Chapter;
|
||||
use App\Domain\Manga\Domain\Model\ValueObject\ChapterId;
|
||||
@@ -13,14 +13,14 @@ use App\Domain\Shared\Domain\Contract\CommandInterface;
|
||||
readonly class DeleteChapterHandler implements CommandHandlerInterface
|
||||
{
|
||||
public function __construct(
|
||||
private ChapterRepositoryInterface $chapterRepository
|
||||
private MangaRepositoryInterface $mangaRepository
|
||||
) {}
|
||||
|
||||
public function handle(CommandInterface $command): void
|
||||
{
|
||||
assert($command instanceof DeleteChapter);
|
||||
|
||||
$chapter = $this->chapterRepository->findVisibleById($command->chapterId);
|
||||
$chapter = $this->mangaRepository->findVisibleChapterById($command->chapterId);
|
||||
|
||||
if (!$chapter) {
|
||||
throw new ChapterNotFoundException($command->chapterId);
|
||||
@@ -33,10 +33,11 @@ readonly class DeleteChapterHandler implements CommandHandlerInterface
|
||||
title: $chapter->getTitle(),
|
||||
volume: $chapter->getVolume(),
|
||||
isVisible: false,
|
||||
cbzPath: $chapter->getCbzPath(),
|
||||
pagesDirectory: $chapter->getPagesDirectory(),
|
||||
pageCount: $chapter->getPageCount(),
|
||||
createdAt: $chapter->getCreatedAt()
|
||||
);
|
||||
|
||||
$this->chapterRepository->save($updatedChapter);
|
||||
$this->mangaRepository->updateChapter($updatedChapter);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user