feat: commit before changing gitea
This commit is contained in:
parent
b05bd98f63
commit
ffceda606f
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Manga\Infrastructure\ApiPlatform\Resource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use App\Domain\Manga\Infrastructure\ApiPlatform\Controller\ImportChapterController;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
#[ApiResource(
|
||||
shortName: 'ImportChapter',
|
||||
operations: [
|
||||
new Post(
|
||||
uriTemplate: '/chapters/import',
|
||||
controller: ImportChapterController::class,
|
||||
deserialize: false,
|
||||
openapiContext: [
|
||||
'summary' => 'Import a chapter from CBZ file',
|
||||
'description' => 'Imports a CBZ file for an existing chapter and stores it',
|
||||
'requestBody' => [
|
||||
'content' => [
|
||||
'multipart/form-data' => [
|
||||
'schema' => [
|
||||
'type' => 'object',
|
||||
'required' => ['mangaId', 'chapterNumber', 'file'],
|
||||
'properties' => [
|
||||
'mangaId' => [
|
||||
'type' => 'string',
|
||||
'format' => 'uuid',
|
||||
'description' => 'The manga UUID'
|
||||
],
|
||||
'chapterNumber' => [
|
||||
'type' => 'number',
|
||||
'description' => 'The chapter number (e.g., 1.5)'
|
||||
],
|
||||
'file' => [
|
||||
'type' => 'string',
|
||||
'format' => 'binary',
|
||||
'description' => 'CBZ file to import (max 500MB)'
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
'responses' => [
|
||||
'200' => [
|
||||
'description' => 'Chapter imported successfully',
|
||||
'content' => [
|
||||
'application/json' => [
|
||||
'schema' => [
|
||||
'type' => 'object',
|
||||
'properties' => [
|
||||
'message' => ['type' => 'string'],
|
||||
'chapterId' => ['type' => 'string']
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
)
|
||||
]
|
||||
)]
|
||||
class ImportChapterResource
|
||||
{
|
||||
public ?string $mangaId = null;
|
||||
|
||||
public ?float $chapterNumber = null;
|
||||
|
||||
public ?File $file = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Manga\Infrastructure\ApiPlatform\Resource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use App\Domain\Manga\Infrastructure\ApiPlatform\Controller\ImportVolumeController;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
|
||||
#[ApiResource(
|
||||
shortName: 'ImportVolume',
|
||||
operations: [
|
||||
new Post(
|
||||
uriTemplate: '/volumes/import',
|
||||
controller: ImportVolumeController::class,
|
||||
deserialize: false,
|
||||
openapiContext: [
|
||||
'summary' => 'Import a volume from CBZ file',
|
||||
'description' => 'Imports a CBZ file for an existing volume and updates all chapters',
|
||||
'requestBody' => [
|
||||
'content' => [
|
||||
'multipart/form-data' => [
|
||||
'schema' => [
|
||||
'type' => 'object',
|
||||
'required' => ['mangaId', 'volumeNumber', 'file'],
|
||||
'properties' => [
|
||||
'mangaId' => [
|
||||
'type' => 'string',
|
||||
'format' => 'uuid',
|
||||
'description' => 'The manga UUID'
|
||||
],
|
||||
'volumeNumber' => [
|
||||
'type' => 'integer',
|
||||
'description' => 'The volume number'
|
||||
],
|
||||
'file' => [
|
||||
'type' => 'string',
|
||||
'format' => 'binary',
|
||||
'description' => 'CBZ file to import (max 500MB)'
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
'responses' => [
|
||||
'200' => [
|
||||
'description' => 'Volume imported successfully',
|
||||
'content' => [
|
||||
'application/json' => [
|
||||
'schema' => [
|
||||
'type' => 'object',
|
||||
'properties' => [
|
||||
'message' => ['type' => 'string'],
|
||||
'mangaId' => ['type' => 'string'],
|
||||
'volumeNumber' => ['type' => 'integer']
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
)
|
||||
]
|
||||
)]
|
||||
class ImportVolumeResource
|
||||
{
|
||||
public ?string $mangaId = null;
|
||||
|
||||
public ?int $volumeNumber = null;
|
||||
|
||||
public ?File $file = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user