51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Domain\Reader\Infrastructure\ApiPlatform\Resource;
|
|
|
|
use ApiPlatform\Metadata\ApiResource;
|
|
use ApiPlatform\Metadata\Get;
|
|
use App\Domain\Reader\Infrastructure\ApiPlatform\State\Provider\ChapterPagesProvider;
|
|
use Symfony\Component\Serializer\Annotation\Groups;
|
|
|
|
#[ApiResource(
|
|
shortName: 'Reader',
|
|
operations: [
|
|
new Get(
|
|
uriTemplate: '/reader/chapter/{chapterId}/pages',
|
|
openapiContext: [
|
|
'summary' => 'Récupère les pages d\'un chapitre',
|
|
'description' => 'Retourne une collection paginée des pages du chapitre',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'chapterId',
|
|
'in' => 'path',
|
|
'required' => true,
|
|
'schema' => ['type' => 'string'],
|
|
],
|
|
[
|
|
'name' => 'page',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer', 'default' => 1],
|
|
],
|
|
[
|
|
'name' => 'itemsPerPage',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer', 'default' => 20],
|
|
],
|
|
],
|
|
],
|
|
provider: ChapterPagesProvider::class
|
|
),
|
|
],
|
|
)]
|
|
class ChapterPagesResource
|
|
{
|
|
public function __construct()
|
|
{
|
|
}
|
|
}
|