feat: Reader working, some work still need to be done

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-02-17 12:02:56 +01:00
parent 33f5a5568a
commit 668702b1fb
20 changed files with 994 additions and 127 deletions

View File

@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace App\Domain\Reader\Domain\Exception;
use App\Domain\Reader\Domain\ValueObject\ChapterId;
use App\Domain\Reader\Domain\ValueObject\PageNumber;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
final class PageNotFoundException extends NotFoundHttpException
{
public static function forPage(ChapterId $chapterId, PageNumber $pageNumber): self
{
return new self(sprintf('La page %d du chapitre %s n\'existe pas', $pageNumber->getValue(), $chapterId->getValue()));
}
}

View File

@@ -25,6 +25,54 @@ use Symfony\Component\Serializer\Annotation\Groups;
'schema' => ['type' => 'string'],
],
],
'responses' => [
'200' => [
'description' => 'Contexte du chapitre',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
'properties' => [
'id' => ['type' => 'string'],
'title' => ['type' => 'string'],
'number' => ['type' => 'string'],
'manga' => [
'type' => 'object',
'properties' => [
'id' => ['type' => 'string'],
'title' => ['type' => 'string']
]
],
'navigation' => [
'type' => 'object',
'properties' => [
'previous' => [
'type' => 'object',
'nullable' => true,
'properties' => [
'id' => ['type' => 'string'],
'number' => ['type' => 'string']
]
],
'next' => [
'type' => 'object',
'nullable' => true,
'properties' => [
'id' => ['type' => 'string'],
'number' => ['type' => 'string']
]
]
]
]
]
]
]
]
],
'404' => [
'description' => 'Chapitre non trouvé'
]
]
],
provider: ChapterContextProvider::class
),

View File

@@ -32,6 +32,34 @@ use App\Domain\Reader\Infrastructure\ApiPlatform\State\Provider\ChapterPageProvi
'description' => 'Le numéro de la page à récupérer'
],
],
'responses' => [
'200' => [
'description' => 'Page du chapitre',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
'properties' => [
'id' => ['type' => 'string'],
'pageNumber' => ['type' => 'integer'],
'base64Content' => ['type' => 'string', 'description' => 'Contenu de l\'image en base64'],
'mimeType' => ['type' => 'string', 'example' => 'image/jpeg'],
'dimensions' => [
'type' => 'object',
'properties' => [
'width' => ['type' => 'integer'],
'height' => ['type' => 'integer']
]
]
]
]
]
]
],
'404' => [
'description' => 'Chapitre ou page non trouvé'
]
]
],
provider: ChapterPageProvider::class
),

View File

@@ -37,6 +37,43 @@ use Symfony\Component\Serializer\Annotation\Groups;
'schema' => ['type' => 'integer', 'default' => 20],
],
],
'responses' => [
'200' => [
'description' => 'Collection paginée des pages du chapitre',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
'properties' => [
'pages' => [
'type' => 'array',
'items' => [
'type' => 'object',
'properties' => [
'number' => ['type' => 'integer'],
'dimensions' => [
'type' => 'object',
'properties' => [
'width' => ['type' => 'integer'],
'height' => ['type' => 'integer']
]
]
]
]
],
'totalItems' => ['type' => 'integer'],
'currentPage' => ['type' => 'integer'],
'itemsPerPage' => ['type' => 'integer'],
'totalPages' => ['type' => 'integer']
]
]
]
]
],
'404' => [
'description' => 'Chapitre non trouvé'
]
]
],
provider: ChapterPagesProvider::class
),