feat: ajout de la description et de la date d'ajout dans le endpoint MangaList

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-02-17 15:15:05 +01:00
parent 140cc14316
commit 7303d63198
4 changed files with 27 additions and 13 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Domain\Manga\Infrastructure\ApiPlatform\Dto;
use ApiPlatform\Metadata\ApiProperty;
use DateTimeImmutable;
readonly class MangaListItem
{
@@ -10,12 +11,14 @@ readonly class MangaListItem
#[ApiProperty(identifier: true)]
public string $id,
public string $title,
public string $description,
public string $slug,
public ?string $imageUrl,
public string $author,
public int $publicationYear,
public array $genres,
public string $status,
public ?float $rating
public ?float $rating,
public DateTimeImmutable $createdAt,
) {}
}

View File

@@ -45,12 +45,14 @@ readonly class GetMangaListStateProvider implements ProviderInterface
id: $manga->getId()->getValue(),
title: $manga->getTitle()->getValue(),
slug: $manga->getSlug()->getValue(),
description: $manga->getDescription(),
imageUrl: $manga->getImageUrl(),
author: $manga->getAuthor(),
publicationYear: $manga->getPublicationYear(),
genres: $manga->getGenres(),
status: $manga->getStatus(),
rating: $manga->getRating()
rating: $manga->getRating(),
createdAt: $manga->getCreatedAt()
);
}
}

View File

@@ -13,6 +13,7 @@ use Doctrine\ORM\EntityManagerInterface;
use App\Domain\Manga\Domain\Model\Chapter;
use App\Domain\Manga\Domain\Model\ValueObject\ChapterId;
use App\Entity\Chapter as EntityChapter;
use DateTime;
readonly class LegacyMangaRepository implements MangaRepositoryInterface
{
@@ -165,17 +166,18 @@ readonly class LegacyMangaRepository implements MangaRepositoryInterface
private function toDomain(EntityManga $entity): DomainManga
{
return new DomainManga(
new MangaId((string) $entity->getId()),
new MangaTitle($entity->getTitle()),
new MangaSlug($entity->getSlug()),
$entity->getDescription(),
$entity->getAuthor(),
$entity->getPublicationYear(),
$entity->getGenres(),
$entity->getStatus(),
$entity->getExternalId() ? new ExternalId($entity->getExternalId()) : null,
$entity->getImageUrl(),
$entity->getRating()
id: new MangaId((string) $entity->getId()),
title: new MangaTitle($entity->getTitle()),
slug: new MangaSlug($entity->getSlug()),
description: $entity->getDescription(),
author: $entity->getAuthor(),
publicationYear: $entity->getPublicationYear(),
genres: $entity->getGenres(),
status: $entity->getStatus(),
externalId: $entity->getExternalId() ? new ExternalId($entity->getExternalId()) : null,
imageUrl: $entity->getImageUrl(),
rating: $entity->getRating(),
createdAt: $entity->getCreatedAt(),
);
}