51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Domain\Manga\Infrastructure\ApiPlatform\Resource;
|
|
|
|
use ApiPlatform\Metadata\ApiResource;
|
|
use ApiPlatform\Metadata\Delete;
|
|
use App\Domain\Manga\Infrastructure\ApiPlatform\State\Processor\DeleteChapterProcessor;
|
|
use App\Domain\Manga\Infrastructure\ApiPlatform\State\Provider\DeleteChapterProvider;
|
|
|
|
#[ApiResource(
|
|
shortName: 'Chapters',
|
|
operations: [
|
|
new Delete(
|
|
uriTemplate: '/manga/chapters/{id}',
|
|
provider: DeleteChapterProvider::class,
|
|
processor: DeleteChapterProcessor::class,
|
|
name: 'delete_chapter',
|
|
openapiContext: [
|
|
'summary' => 'Delete a chapter (soft delete)',
|
|
'description' => 'Marks a chapter as deleted by setting its visibility to false',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'id',
|
|
'in' => 'path',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string'
|
|
],
|
|
'description' => 'The chapter ID'
|
|
]
|
|
],
|
|
'responses' => [
|
|
'204' => [
|
|
'description' => 'Chapter successfully deleted'
|
|
],
|
|
'404' => [
|
|
'description' => 'Chapter not found'
|
|
]
|
|
]
|
|
]
|
|
)
|
|
]
|
|
)]
|
|
class DeleteChapterResource
|
|
{
|
|
public function __construct(
|
|
public string $id
|
|
) {
|
|
}
|
|
}
|