rename upload use cases
This commit is contained in:
parent
bd38e350cf
commit
d0810ba4b3
5 changed files with 12 additions and 12 deletions
|
|
@ -16,8 +16,8 @@ class UpdateElement
|
||||||
private UpdateRichText $updateRichText,
|
private UpdateRichText $updateRichText,
|
||||||
private UpdatePdfPath $updatePdfPath,
|
private UpdatePdfPath $updatePdfPath,
|
||||||
private UpdateYoutubeUrl $updateYoutubeUrl,
|
private UpdateYoutubeUrl $updateYoutubeUrl,
|
||||||
private UpdateElementIconImage $updateElementIconImage,
|
private UpdateIconImage $updateIconImage,
|
||||||
private UpdateElementPdf $updateElementPdf,
|
private UpdatePdf $updatePdf,
|
||||||
private ElementRepository $elementRepository,
|
private ElementRepository $elementRepository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
@ -83,8 +83,8 @@ class UpdateElement
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if ($request->iconImageContents !== null) {
|
if ($request->iconImageContents !== null) {
|
||||||
$this->updateElementIconImage->execute(
|
$this->updateIconImage->execute(
|
||||||
new UpdateElementIconImageRequest(
|
new UpdateIconImageRequest(
|
||||||
id: $request->id,
|
id: $request->id,
|
||||||
iconImageContents: $request->iconImageContents,
|
iconImageContents: $request->iconImageContents,
|
||||||
iconImageOriginalName: $request->iconImageOriginalName,
|
iconImageOriginalName: $request->iconImageOriginalName,
|
||||||
|
|
@ -94,8 +94,8 @@ class UpdateElement
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($request->pdfContents !== null) {
|
if ($request->pdfContents !== null) {
|
||||||
$this->updateElementPdf->execute(
|
$this->updatePdf->execute(
|
||||||
new UpdateElementPdfRequest(
|
new UpdatePdfRequest(
|
||||||
id: $request->id,
|
id: $request->id,
|
||||||
pdfContents: $request->pdfContents,
|
pdfContents: $request->pdfContents,
|
||||||
pdfOriginalName: $request->pdfOriginalName,
|
pdfOriginalName: $request->pdfOriginalName,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ use App\Exceptions\NotFoundException;
|
||||||
use App\Shared\Files\FileToUpload;
|
use App\Shared\Files\FileToUpload;
|
||||||
use App\Shared\Files\FileUploader;
|
use App\Shared\Files\FileUploader;
|
||||||
|
|
||||||
class UpdateElementIconImage
|
class UpdateIconImage
|
||||||
{
|
{
|
||||||
private const ALLOWED_MIME_TYPES = [
|
private const ALLOWED_MIME_TYPES = [
|
||||||
'image/jpeg',
|
'image/jpeg',
|
||||||
|
|
@ -29,7 +29,7 @@ class UpdateElementIconImage
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
* @throws NotFoundException
|
* @throws NotFoundException
|
||||||
*/
|
*/
|
||||||
public function execute(UpdateElementIconImageRequest $request): Element
|
public function execute(UpdateIconImageRequest $request): Element
|
||||||
{
|
{
|
||||||
if ($request->id === null) {
|
if ($request->id === null) {
|
||||||
throw new BadRequestException('id is required');
|
throw new BadRequestException('id is required');
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace App\Element\UseCases\UpdateElement;
|
namespace App\Element\UseCases\UpdateElement;
|
||||||
|
|
||||||
class UpdateElementIconImageRequest
|
class UpdateIconImageRequest
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public ?int $id,
|
public ?int $id,
|
||||||
|
|
@ -9,7 +9,7 @@ use App\Exceptions\NotFoundException;
|
||||||
use App\Shared\Files\FileToUpload;
|
use App\Shared\Files\FileToUpload;
|
||||||
use App\Shared\Files\FileUploader;
|
use App\Shared\Files\FileUploader;
|
||||||
|
|
||||||
class UpdateElementPdf
|
class UpdatePdf
|
||||||
{
|
{
|
||||||
private const ALLOWED_MIME_TYPES = [
|
private const ALLOWED_MIME_TYPES = [
|
||||||
'application/pdf',
|
'application/pdf',
|
||||||
|
|
@ -27,7 +27,7 @@ class UpdateElementPdf
|
||||||
* @throws BadRequestException
|
* @throws BadRequestException
|
||||||
* @throws NotFoundException
|
* @throws NotFoundException
|
||||||
*/
|
*/
|
||||||
public function execute(UpdateElementPdfRequest $request): Element
|
public function execute(UpdatePdfRequest $request): Element
|
||||||
{
|
{
|
||||||
if ($request->id === null) {
|
if ($request->id === null) {
|
||||||
throw new BadRequestException('id is required');
|
throw new BadRequestException('id is required');
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace App\Element\UseCases\UpdateElement;
|
namespace App\Element\UseCases\UpdateElement;
|
||||||
|
|
||||||
class UpdateElementPdfRequest
|
class UpdatePdfRequest
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public ?int $id,
|
public ?int $id,
|
||||||
Loading…
Add table
Add a link
Reference in a new issue