feat: ajout d'une route GetMangaByIdHandler.php et fix de la SearchBar.vue
This commit is contained in:
parent
ed0a075a6c
commit
d9e935f7de
@@ -11,7 +11,7 @@ use App\Domain\Manga\Infrastructure\ApiPlatform\State\Provider\GetMangaStateProv
|
||||
shortName: 'Manga',
|
||||
operations: [
|
||||
new Get(
|
||||
uriTemplate: '/mangas/{id}',
|
||||
uriTemplate: '/mangas/by-id/{id}',
|
||||
provider: GetMangaStateProvider::class,
|
||||
output: MangaDetail::class,
|
||||
openapiContext: [
|
||||
|
||||
@@ -8,10 +8,10 @@ use App\Domain\Manga\Infrastructure\ApiPlatform\Dto\MangaSearchCollection;
|
||||
use App\Domain\Manga\Infrastructure\ApiPlatform\State\Provider\SearchMangaStateProvider;
|
||||
|
||||
#[ApiResource(
|
||||
shortName: 'Manga',
|
||||
shortName: 'Mangadex',
|
||||
operations: [
|
||||
new Get(
|
||||
uriTemplate: '/mangas-search',
|
||||
uriTemplate: '/mangadex-search',
|
||||
openapiContext: [
|
||||
'parameters' => [
|
||||
[
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Manga\Infrastructure\ApiPlatform\Resource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Domain\Manga\Infrastructure\ApiPlatform\Dto\MangaSearchCollection;
|
||||
use App\Domain\Manga\Infrastructure\ApiPlatform\State\Provider\SearchLocalMangaStateProvider;
|
||||
|
||||
#[ApiResource(
|
||||
shortName: 'Manga',
|
||||
operations: [
|
||||
new Get(
|
||||
uriTemplate: '/mangas/search',
|
||||
provider: SearchLocalMangaStateProvider::class,
|
||||
output: MangaSearchCollection::class,
|
||||
status: 200,
|
||||
openapiContext: [
|
||||
'summary' => 'Recherche des mangas dans la bibliothèque locale',
|
||||
'description' => 'Recherche des mangas par titre, slug ou auteur (minimum 3 caractères)',
|
||||
'parameters' => [
|
||||
[
|
||||
'name' => 'q',
|
||||
'in' => 'query',
|
||||
'required' => true,
|
||||
'schema' => [
|
||||
'type' => 'string',
|
||||
'minLength' => 3
|
||||
],
|
||||
'description' => 'Terme de recherche (minimum 3 caractères)'
|
||||
],
|
||||
[
|
||||
'name' => 'page',
|
||||
'in' => 'query',
|
||||
'required' => false,
|
||||
'schema' => [
|
||||
'type' => 'integer',
|
||||
'default' => 1,
|
||||
'minimum' => 1
|
||||
],
|
||||
'description' => 'Numéro de page'
|
||||
],
|
||||
[
|
||||
'name' => 'limit',
|
||||
'in' => 'query',
|
||||
'required' => false,
|
||||
'schema' => [
|
||||
'type' => 'integer',
|
||||
'default' => 20,
|
||||
'minimum' => 1,
|
||||
'maximum' => 50
|
||||
],
|
||||
'description' => 'Nombre de résultats par page'
|
||||
]
|
||||
],
|
||||
'responses' => [
|
||||
'200' => [
|
||||
'description' => 'Résultats de la recherche',
|
||||
'content' => [
|
||||
'application/json' => [
|
||||
'schema' => [
|
||||
'type' => 'object',
|
||||
'properties' => [
|
||||
'items' => [
|
||||
'type' => 'array',
|
||||
'items' => [
|
||||
'$ref' => '#/components/schemas/MangaSearchItem'
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
'400' => [
|
||||
'description' => 'Paramètres de recherche invalides'
|
||||
]
|
||||
]
|
||||
]
|
||||
)
|
||||
]
|
||||
)]
|
||||
class SearchLocalMangaResource
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user