diff --git a/src/Domain/Manga/Domain/Model/Manga.php b/src/Domain/Manga/Domain/Model/Manga.php index 8b3a4b7..bfd0786 100644 --- a/src/Domain/Manga/Domain/Model/Manga.php +++ b/src/Domain/Manga/Domain/Model/Manga.php @@ -7,6 +7,7 @@ use App\Domain\Manga\Domain\Model\ValueObject\ImageUrls; use App\Domain\Manga\Domain\Model\ValueObject\MangaId; use App\Domain\Manga\Domain\Model\ValueObject\MangaSlug; use App\Domain\Manga\Domain\Model\ValueObject\MangaTitle; +use DateTimeImmutable; final class Manga { @@ -23,6 +24,7 @@ final class Manga private ?string $imageUrl = null, private ?float $rating = null, private ?ImageUrls $imageUrls = null, + private ?DateTimeImmutable $createdAt = null, ) {} public function getId(): MangaId @@ -99,4 +101,9 @@ final class Manga { $this->imageUrls = $imageUrls; } + + public function getCreatedAt(): ?DateTimeImmutable + { + return $this->createdAt; + } } \ No newline at end of file diff --git a/src/Domain/Manga/Infrastructure/ApiPlatform/Dto/MangaListItem.php b/src/Domain/Manga/Infrastructure/ApiPlatform/Dto/MangaListItem.php index 268c1af..9e7040c 100644 --- a/src/Domain/Manga/Infrastructure/ApiPlatform/Dto/MangaListItem.php +++ b/src/Domain/Manga/Infrastructure/ApiPlatform/Dto/MangaListItem.php @@ -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, ) {} } \ No newline at end of file diff --git a/src/Domain/Manga/Infrastructure/ApiPlatform/State/Provider/GetMangaListStateProvider.php b/src/Domain/Manga/Infrastructure/ApiPlatform/State/Provider/GetMangaListStateProvider.php index 4749fed..659bc6a 100644 --- a/src/Domain/Manga/Infrastructure/ApiPlatform/State/Provider/GetMangaListStateProvider.php +++ b/src/Domain/Manga/Infrastructure/ApiPlatform/State/Provider/GetMangaListStateProvider.php @@ -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() ); } } \ No newline at end of file diff --git a/src/Domain/Manga/Infrastructure/Persistence/LegacyMangaRepository.php b/src/Domain/Manga/Infrastructure/Persistence/LegacyMangaRepository.php index d01f291..852bf83 100644 --- a/src/Domain/Manga/Infrastructure/Persistence/LegacyMangaRepository.php +++ b/src/Domain/Manga/Infrastructure/Persistence/LegacyMangaRepository.php @@ -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(), ); }