create filesystem abstraction
This commit is contained in:
parent
be2c51bfb7
commit
d59d444952
14 changed files with 44 additions and 64 deletions
|
|
@ -7,7 +7,7 @@ use App\Element\ElementRepository;
|
|||
use App\Exceptions\BadRequestException;
|
||||
use App\Exceptions\NotFoundException;
|
||||
use App\Shared\Files\FileToUpload;
|
||||
use App\Shared\Files\FileUploader;
|
||||
use App\Shared\Files\Filesystem;
|
||||
|
||||
class UpdateIconImage
|
||||
{
|
||||
|
|
@ -21,7 +21,7 @@ class UpdateIconImage
|
|||
|
||||
public function __construct(
|
||||
private ElementRepository $elementRepository,
|
||||
private FileUploader $fileUploader,
|
||||
private Filesystem $filesystem,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ class UpdateIconImage
|
|||
mimeType: $request->fileMimeType,
|
||||
sizeBytes: $request->fileSizeBytes,
|
||||
);
|
||||
$path = $this->fileUploader->upload($iconImage, 'element-icons');
|
||||
$path = $this->filesystem->upload($iconImage, 'element-icons');
|
||||
$element->setIconImageUrl($path);
|
||||
|
||||
return $this->elementRepository->update($element);
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ use App\Element\Element;
|
|||
use App\Element\ElementRepository;
|
||||
use App\Exceptions\BadRequestException;
|
||||
use App\Exceptions\NotFoundException;
|
||||
use App\Shared\Files\FileUploader;
|
||||
use App\Shared\Files\Filesystem;
|
||||
|
||||
class UpdateIconImageUrl
|
||||
{
|
||||
public function __construct(
|
||||
private ElementRepository $elementRepository,
|
||||
private FileUploader $fileUploader,
|
||||
private Filesystem $filesystem,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -60,6 +60,6 @@ class UpdateIconImageUrl
|
|||
return;
|
||||
}
|
||||
|
||||
$this->fileUploader->delete($path);
|
||||
$this->filesystem->delete($path);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use App\Element\ElementRepository;
|
|||
use App\Exceptions\BadRequestException;
|
||||
use App\Exceptions\NotFoundException;
|
||||
use App\Shared\Files\FileToUpload;
|
||||
use App\Shared\Files\FileUploader;
|
||||
use App\Shared\Files\Filesystem;
|
||||
|
||||
class UpdateLongPdf
|
||||
{
|
||||
|
|
@ -19,7 +19,7 @@ class UpdateLongPdf
|
|||
|
||||
public function __construct(
|
||||
private ElementRepository $elementRepository,
|
||||
private FileUploader $fileUploader,
|
||||
private Filesystem $filesystem,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ class UpdateLongPdf
|
|||
mimeType: $request->fileMimeType,
|
||||
sizeBytes: $request->fileSizeBytes,
|
||||
);
|
||||
$path = $this->fileUploader->upload($pdf, 'element-pdfs/long');
|
||||
$path = $this->filesystem->upload($pdf, 'element-pdfs/long');
|
||||
$element->setLongPdfPath($path);
|
||||
|
||||
return $this->elementRepository->update($element);
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ use App\Element\Element;
|
|||
use App\Element\ElementRepository;
|
||||
use App\Exceptions\BadRequestException;
|
||||
use App\Exceptions\NotFoundException;
|
||||
use App\Shared\Files\FileUploader;
|
||||
use App\Shared\Files\Filesystem;
|
||||
|
||||
class UpdateLongPdfPath
|
||||
{
|
||||
public function __construct(
|
||||
private ElementRepository $elementRepository,
|
||||
private FileUploader $fileUploader,
|
||||
private Filesystem $filesystem,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -60,6 +60,6 @@ class UpdateLongPdfPath
|
|||
return;
|
||||
}
|
||||
|
||||
$this->fileUploader->delete($path);
|
||||
$this->filesystem->delete($path);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use App\Element\ElementRepository;
|
|||
use App\Exceptions\BadRequestException;
|
||||
use App\Exceptions\NotFoundException;
|
||||
use App\Shared\Files\FileToUpload;
|
||||
use App\Shared\Files\FileUploader;
|
||||
use App\Shared\Files\Filesystem;
|
||||
|
||||
class UpdateShortPdf
|
||||
{
|
||||
|
|
@ -19,7 +19,7 @@ class UpdateShortPdf
|
|||
|
||||
public function __construct(
|
||||
private ElementRepository $elementRepository,
|
||||
private FileUploader $fileUploader,
|
||||
private Filesystem $filesystem,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ class UpdateShortPdf
|
|||
mimeType: $request->fileMimeType,
|
||||
sizeBytes: $request->fileSizeBytes,
|
||||
);
|
||||
$path = $this->fileUploader->upload($pdf, 'element-pdfs/short');
|
||||
$path = $this->filesystem->upload($pdf, 'element-pdfs/short');
|
||||
$element->setShortPdfPath($path);
|
||||
|
||||
return $this->elementRepository->update($element);
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ use App\Element\Element;
|
|||
use App\Element\ElementRepository;
|
||||
use App\Exceptions\BadRequestException;
|
||||
use App\Exceptions\NotFoundException;
|
||||
use App\Shared\Files\FileUploader;
|
||||
use App\Shared\Files\Filesystem;
|
||||
|
||||
class UpdateShortPdfPath
|
||||
{
|
||||
public function __construct(
|
||||
private ElementRepository $elementRepository,
|
||||
private FileUploader $fileUploader,
|
||||
private Filesystem $filesystem,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -60,6 +60,6 @@ class UpdateShortPdfPath
|
|||
return;
|
||||
}
|
||||
|
||||
$this->fileUploader->delete($path);
|
||||
$this->filesystem->delete($path);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue