Merge branch 'main' of ssh://git.homelab.nestor-server.fr:2222/colgora/Mangarr
All checks were successful
Build and Deploy / deploy (push) Successful in 1m46s

# Conflicts:
#	src/Domain/Manga/Application/CommandHandler/DeleteChapterHandler.php
#	src/Domain/Manga/Application/CommandHandler/EditMultipleChaptersHandler.php
#	src/Domain/Manga/Application/EventListener/ChapterImportedEventListener.php
#	src/Domain/Manga/Application/EventListener/VolumeImportedEventListener.php
#	src/Domain/Manga/Application/Response/ChapterResponse.php
#	src/Domain/Manga/Infrastructure/ApiPlatform/State/Provider/DeleteCbzProvider.php
#	src/Domain/Manga/Infrastructure/ApiPlatform/State/Provider/DeleteChapterProvider.php
#	src/Domain/Manga/Infrastructure/Persistence/Repository/LegacyChapterRepository.php
This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2026-03-09 20:47:43 +01:00
33 changed files with 549 additions and 550 deletions

View File

@@ -4,7 +4,7 @@ namespace App\Domain\Manga\Application\QueryHandler;
use App\Domain\Manga\Application\Query\DownloadCbz;
use App\Domain\Manga\Application\Response\DownloadResponse;
use App\Domain\Manga\Domain\Contract\Repository\ChapterRepositoryInterface;
use App\Domain\Manga\Domain\Contract\Repository\MangaRepositoryInterface;
use App\Domain\Manga\Domain\Contract\Service\FileServiceInterface;
use App\Domain\Manga\Domain\Exception\CbzFileNotFoundException;
use App\Domain\Manga\Domain\Exception\ChapterNotFoundException;
@@ -16,7 +16,7 @@ use App\Domain\Shared\Domain\Contract\ResponseInterface;
readonly class DownloadCbzHandler implements QueryHandlerInterface
{
public function __construct(
private ChapterRepositoryInterface $chapterRepository,
private MangaRepositoryInterface $mangaRepository,
private FileServiceInterface $fileService
) {
}
@@ -25,7 +25,7 @@ readonly class DownloadCbzHandler implements QueryHandlerInterface
{
assert($query instanceof DownloadCbz);
$chapter = $this->chapterRepository->findVisibleById($query->chapterId);
$chapter = $this->mangaRepository->findVisibleChapterById($query->chapterId);
if (!$chapter) {
throw new ChapterNotFoundException($query->chapterId);
@@ -35,14 +35,11 @@ readonly class DownloadCbzHandler implements QueryHandlerInterface
throw new ChapterNotAvailableException($query->chapterId);
}
// Use the actual CBZ path from the chapter
$cbzPath = $chapter->getCbzPath();
// Extract the existing filename from the path
$filename = basename($cbzPath);
$pagesDirectory = $chapter->getPagesDirectory();
$filename = basename($pagesDirectory);
try {
$httpResponse = $this->fileService->downloadCbz($cbzPath, $filename);
$httpResponse = $this->fileService->downloadCbz($pagesDirectory, $filename);
} catch (CbzFileNotFoundException $e) {
throw new ChapterNotAvailableException($query->chapterId);
}

View File

@@ -4,7 +4,6 @@ namespace App\Domain\Manga\Application\QueryHandler;
use App\Domain\Manga\Application\Query\DownloadVolume;
use App\Domain\Manga\Application\Response\DownloadResponse;
use App\Domain\Manga\Domain\Contract\Repository\ChapterRepositoryInterface;
use App\Domain\Manga\Domain\Contract\Repository\MangaRepositoryInterface;
use App\Domain\Manga\Domain\Contract\Service\FileServiceInterface;
use App\Domain\Manga\Domain\Exception\MangaNotFoundException;
@@ -16,7 +15,6 @@ use App\Domain\Shared\Domain\Contract\ResponseInterface;
readonly class DownloadVolumeHandler implements QueryHandlerInterface
{
public function __construct(
private ChapterRepositoryInterface $chapterRepository,
private MangaRepositoryInterface $mangaRepository,
private FileServiceInterface $fileService
) {
@@ -32,7 +30,7 @@ readonly class DownloadVolumeHandler implements QueryHandlerInterface
throw new MangaNotFoundException($query->mangaId);
}
$chapters = $this->chapterRepository->findVisibleWithCbzByMangaIdAndVolume(
$chapters = $this->mangaRepository->findVisibleChaptersWithPagesByMangaIdAndVolume(
$query->mangaId,
$query->volume
);
@@ -41,10 +39,9 @@ readonly class DownloadVolumeHandler implements QueryHandlerInterface
throw new VolumeNotFoundException($query->mangaId, $query->volume);
}
// Collect CBZ paths for all chapters
$cbzPaths = [];
foreach ($chapters as $chapter) {
$cbzPaths[] = $chapter->getCbzPath();
$cbzPaths[] = $chapter->getPagesDirectory();
}
$volumeName = sprintf(

View File

@@ -40,8 +40,8 @@ readonly class GetMangaChaptersHandler
title: $chapter->getTitle(),
volume: $chapter->getVolume(),
isVisible: $chapter->isVisible(),
cbzPath: $chapter->getCbzPath(),
createdAt: $chapter->getCreatedAt()
pagesDirectory: $chapter->getPagesDirectory(),
createdAt: $chapter->getCreatedAt()->format(\DateTimeInterface::RFC3339)
),
$chapters
),