Files
Mangarr/src/Domain/Manga/Infrastructure/ApiPlatform/Resource/FetchMangaChaptersResource.php
ext.jeremy.guillot@maxicoffee.domains 7506a7a3c1 style: apply php-cs-fixer formatting (PSR-12)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 20:46:59 +01:00

62 lines
2.4 KiB
PHP

<?php
namespace App\Domain\Manga\Infrastructure\ApiPlatform\Resource;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Post;
use App\Domain\Manga\Infrastructure\ApiPlatform\State\Processor\FetchMangaChaptersProcessor;
use Symfony\Component\Validator\Constraints as Assert;
#[ApiResource(
shortName: 'Mangadex',
operations: [
new Post(
uriTemplate: '/manga/chapters/fetch',
processor: FetchMangaChaptersProcessor::class,
status: 202,
description: 'Déclenche la récupération des chapitres d\'un manga',
openapiContext: [
'summary' => 'Récupérer les chapitres d\'un manga',
'description' => 'Lance le processus de récupération des chapitres depuis la source externe pour un manga donné',
'requestBody' => [
'description' => 'Données requises pour récupérer les chapitres',
'required' => true,
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
'properties' => [
'mangaId' => [
'type' => 'string',
// 'format' => 'uuid',
'description' => 'L\'identifiant unique du manga',
// 'example' => '123e4567-e89b-12d3-a456-426614174000'
]
],
'required' => ['mangaId']
]
]
]
],
'responses' => [
'202' => [
'description' => 'Demande de récupération acceptée et mise en file d\'attente'
],
'422' => [
'description' => 'Données de validation invalides'
]
]
]
)
]
)]
class FetchMangaChaptersResource
{
public function __construct(
#[Assert\NotBlank(message: 'L\'identifiant du manga est obligatoire')]
// #[Assert\Uuid(message: 'L\'identifiant du manga doit être un UUID valide')]
public string $mangaId
) {
}
}