feat: ajout de la gestion des commandes pour la suppression des fichiers CBZ et des chapitres, avec création des gestionnaires et des ressources API correspondantes
This commit is contained in:
parent
7fe4ac0d3b
commit
37e1b202c2
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Manga\Infrastructure\ApiPlatform\Resource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Delete;
|
||||
use App\Domain\Manga\Infrastructure\ApiPlatform\State\Processor\DeleteCbzProcessor;
|
||||
use App\Domain\Manga\Infrastructure\ApiPlatform\State\Provider\DeleteCbzProvider;
|
||||
|
||||
#[ApiResource(
|
||||
shortName: 'Cbz',
|
||||
operations: [
|
||||
new Delete(
|
||||
uriTemplate: '/manga/chapters/{id}/cbz',
|
||||
provider: DeleteCbzProvider::class,
|
||||
processor: DeleteCbzProcessor::class,
|
||||
name: 'delete_cbz',
|
||||
openapiContext: [
|
||||
'summary' => 'Delete chapter CBZ file',
|
||||
'description' => 'Removes the CBZ file for a specific chapter and updates the chapter accordingly',
|
||||
'parameters' => [
|
||||
[
|
||||
'name' => 'id',
|
||||
'in' => 'path',
|
||||
'required' => true,
|
||||
'schema' => [
|
||||
'type' => 'string'
|
||||
],
|
||||
'description' => 'The chapter ID'
|
||||
]
|
||||
],
|
||||
'responses' => [
|
||||
'204' => [
|
||||
'description' => 'CBZ file successfully deleted'
|
||||
],
|
||||
'404' => [
|
||||
'description' => 'Chapter or CBZ file not found'
|
||||
]
|
||||
]
|
||||
]
|
||||
)
|
||||
]
|
||||
)]
|
||||
class DeleteCbzResource
|
||||
{
|
||||
public function __construct(
|
||||
public string $id
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Manga\Infrastructure\ApiPlatform\Resource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Domain\Manga\Infrastructure\ApiPlatform\State\Provider\DownloadCbzProvider;
|
||||
|
||||
#[ApiResource(
|
||||
shortName: 'Cbz',
|
||||
operations: [
|
||||
new Get(
|
||||
uriTemplate: '/manga/chapters/{id}/download',
|
||||
provider: DownloadCbzProvider::class,
|
||||
output: false,
|
||||
name: 'download_chapter_cbz'
|
||||
)
|
||||
]
|
||||
)]
|
||||
class DownloadCbzResource
|
||||
{
|
||||
public function __construct(
|
||||
public string $id
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Manga\Infrastructure\ApiPlatform\Resource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Domain\Manga\Infrastructure\ApiPlatform\State\Provider\DownloadVolumeProvider;
|
||||
|
||||
#[ApiResource(
|
||||
shortName: 'Cbz',
|
||||
operations: [
|
||||
new Get(
|
||||
uriTemplate: '/mangas/{id}/volumes/{volume}/download',
|
||||
provider: DownloadVolumeProvider::class,
|
||||
output: false,
|
||||
name: 'download_manga_volume'
|
||||
)
|
||||
]
|
||||
)]
|
||||
class DownloadVolumeResource
|
||||
{
|
||||
public function __construct(
|
||||
public string $id,
|
||||
public int $volume
|
||||
) {}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ use App\Domain\Manga\Infrastructure\ApiPlatform\State\Processor\FetchMangaChapte
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
#[ApiResource(
|
||||
shortName: 'MangaChapters',
|
||||
shortName: 'Chapters',
|
||||
operations: [
|
||||
new Post(
|
||||
uriTemplate: '/manga/chapters/fetch',
|
||||
@@ -23,4 +23,4 @@ class FetchMangaChaptersResource
|
||||
#[Assert\NotBlank]
|
||||
public string $externalId
|
||||
) {}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ use App\Domain\Manga\Infrastructure\ApiPlatform\Dto\ChapterCollection;
|
||||
use App\Domain\Manga\Infrastructure\ApiPlatform\State\Provider\GetMangaChaptersStateProvider;
|
||||
|
||||
#[ApiResource(
|
||||
shortName: 'MangaChapters',
|
||||
shortName: 'Chapters',
|
||||
operations: [
|
||||
new Get(
|
||||
uriTemplate: '/mangas/{id}/chapters',
|
||||
@@ -63,4 +63,4 @@ use App\Domain\Manga\Infrastructure\ApiPlatform\State\Provider\GetMangaChaptersS
|
||||
)]
|
||||
class MangaChaptersResource
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user