feat: Reader working, some work still need to be done
This commit is contained in:
parent
33f5a5568a
commit
668702b1fb
17
src/Domain/Reader/Domain/Exception/PageNotFoundException.php
Normal file
17
src/Domain/Reader/Domain/Exception/PageNotFoundException.php
Normal 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()));
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
),
|
||||
|
||||
@@ -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
|
||||
),
|
||||
|
||||
@@ -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
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user