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:
ext.jeremy.guillot@maxicoffee.domains
2026-03-09 17:54:35 +01:00
parent dae215dd3d
commit c50f1638ee
27 changed files with 410 additions and 419 deletions

View File

@@ -4,7 +4,7 @@ namespace App\Domain\Manga\Infrastructure\ApiPlatform\State\Provider;
use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProviderInterface;
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\Exception\CbzFileNotFoundException;
use App\Domain\Manga\Infrastructure\ApiPlatform\Resource\DeleteCbzResource;
@@ -13,7 +13,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
readonly class DeleteCbzProvider implements ProviderInterface
{
public function __construct(
private ChapterRepositoryInterface $chapterRepository
private MangaRepositoryInterface $mangaRepository
) {}
public function provide(Operation $operation, array $uriVariables = [], array $context = []): DeleteCbzResource
@@ -25,7 +25,7 @@ readonly class DeleteCbzProvider implements ProviderInterface
$chapterId = $uriVariables['id'];
try {
$chapter = $this->chapterRepository->findVisibleById($chapterId);
$chapter = $this->mangaRepository->findVisibleChapterById($chapterId);
if (!$chapter) {
throw new ChapterNotFoundException($chapterId);

View File

@@ -4,7 +4,7 @@ namespace App\Domain\Manga\Infrastructure\ApiPlatform\State\Provider;
use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProviderInterface;
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\Infrastructure\ApiPlatform\Resource\DeleteChapterResource;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -12,7 +12,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
readonly class DeleteChapterProvider implements ProviderInterface
{
public function __construct(
private ChapterRepositoryInterface $chapterRepository
private MangaRepositoryInterface $mangaRepository
) {}
public function provide(Operation $operation, array $uriVariables = [], array $context = []): DeleteChapterResource
@@ -24,7 +24,7 @@ readonly class DeleteChapterProvider implements ProviderInterface
$chapterId = $uriVariables['id'];
try {
$chapter = $this->chapterRepository->findVisibleById($chapterId);
$chapter = $this->mangaRepository->findVisibleChapterById($chapterId);
if (!$chapter) {
throw new ChapterNotFoundException($chapterId);

View File

@@ -52,7 +52,7 @@ readonly class GetMangaChaptersStateProvider implements ProviderInterface
title: $chapter->title,
volume: $chapter->volume,
isVisible: $chapter->isVisible,
isAvailable: $chapter->cbzPath !== null,
isAvailable: $chapter->pagesDirectory !== null,
createdAt: $chapter->createdAt->format(\DateTimeInterface::RFC3339)
);
}