30 lines
870 B
PHP
30 lines
870 B
PHP
<?php
|
|
|
|
namespace App\Controller\Upload;
|
|
|
|
use App\Service\Upload\UploadHandler;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Symfony\Component\Routing\Attribute\Route;
|
|
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
|
|
|
class DeleteController extends AbstractController
|
|
{
|
|
public function __construct(private readonly UploadHandler $uploadHandler)
|
|
{}
|
|
|
|
#[Route('/upload/delete', name: 'app_upload_delete', methods: ['DELETE'])]
|
|
#[IsGranted('ROLE_USER')]
|
|
public function index(Request $request): JsonResponse
|
|
{
|
|
$uuid = $request->get('uuid');
|
|
|
|
$this->uploadHandler->removeUploadFromSession($uuid);
|
|
|
|
return $this->json([
|
|
'success' => true,
|
|
'uuid' => $uuid,
|
|
]);
|
|
}
|
|
} |