67 lines
2.2 KiB
PHP
67 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Domain\Manga\Infrastructure\ApiPlatform\Resource;
|
|
|
|
use ApiPlatform\Metadata\ApiResource;
|
|
use ApiPlatform\Metadata\Get;
|
|
use App\Domain\Manga\Infrastructure\ApiPlatform\Dto\ChapterCollection;
|
|
use App\Domain\Manga\Infrastructure\ApiPlatform\State\Provider\GetMangaChaptersStateProvider;
|
|
|
|
#[ApiResource(
|
|
shortName: 'Chapters',
|
|
operations: [
|
|
new Get(
|
|
uriTemplate: '/mangas/{id}/chapters',
|
|
provider: GetMangaChaptersStateProvider::class,
|
|
output: ChapterCollection::class,
|
|
openapiContext: [
|
|
'parameters' => [
|
|
[
|
|
'name' => 'id',
|
|
'in' => 'path',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string'
|
|
],
|
|
'description' => 'The manga identifier'
|
|
],
|
|
[
|
|
'name' => 'page',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => [
|
|
'type' => 'integer',
|
|
'default' => 1
|
|
],
|
|
'description' => 'The page number'
|
|
],
|
|
[
|
|
'name' => 'limit',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => [
|
|
'type' => 'integer',
|
|
'default' => 20
|
|
],
|
|
'description' => 'Number of items per page'
|
|
],
|
|
[
|
|
'name' => 'sortOrder',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => ['asc', 'desc'],
|
|
'default' => 'desc'
|
|
],
|
|
'description' => 'Sort order for chapters'
|
|
]
|
|
]
|
|
]
|
|
)
|
|
]
|
|
)]
|
|
class MangaChaptersResource
|
|
{
|
|
}
|