simplify media deletion

This commit is contained in:
Yisroel Baum 2026-06-02 17:12:44 +03:00
parent 247433bc60
commit 01434a9b2d
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
4 changed files with 34 additions and 15 deletions

View file

@ -10,8 +10,6 @@ use App\Shared\Files\FileUploader;
class UpdateIconImageUrl
{
private const MANAGED_FOLDER_PREFIX = 'element-icons/';
public function __construct(
private ElementRepository $elementRepository,
private FileUploader $fileUploader,
@ -62,10 +60,6 @@ class UpdateIconImageUrl
return;
}
if (! str_starts_with($path, self::MANAGED_FOLDER_PREFIX)) {
return;
}
$this->fileUploader->delete($path);
}
}

View file

@ -10,8 +10,6 @@ use App\Shared\Files\FileUploader;
class UpdatePdfPath
{
private const MANAGED_FOLDER_PREFIX = 'element-pdfs/';
public function __construct(
private ElementRepository $elementRepository,
private FileUploader $fileUploader,
@ -62,10 +60,6 @@ class UpdatePdfPath
return;
}
if (! str_starts_with($path, self::MANAGED_FOLDER_PREFIX)) {
return;
}
$this->fileUploader->delete($path);
}
}