feat: ajout de la gestion de la disponibilité des chapitres dans les réponses et les modèles, avec mise à jour des classes concernées

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-03-27 11:15:36 +01:00
parent 346fede878
commit 6ea24deacf
6 changed files with 20 additions and 10 deletions

View File

@@ -13,6 +13,7 @@ readonly class ChapterListItem
public ?string $title,
public ?int $volume,
public bool $isVisible,
public bool $isAvailable,
public string $createdAt
) {}
}

View File

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

View File

@@ -222,13 +222,13 @@ readonly class LegacyMangaRepository implements MangaRepositoryInterface
private function toChapterDomain(EntityChapter $entity): Chapter
{
return new Chapter(
new ChapterId((string) $entity->getId()),
$entity->getManga()->getId(),
$entity->getNumber(),
$entity->getTitle(),
$entity->getVolume(),
$entity->isVisible(),
new \DateTimeImmutable()
id: new ChapterId((string) $entity->getId()),
mangaId: $entity->getManga()->getId(),
number: $entity->getNumber(),
title: $entity->getTitle(),
volume: $entity->getVolume(),
isVisible: $entity->isVisible(),
isAvailable: $entity->getCbzPath() !== null
);
}
}