wip-feat: adds download message queue logic
This commit is contained in:
25
src/Controller/DownloadController.php
Normal file
25
src/Controller/DownloadController.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Download\Action\Input\DownloadMediaInput;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Messenger\MessageBusInterface;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class DownloadController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private MessageBusInterface $bus,
|
||||
) {}
|
||||
|
||||
#[Route('/download', name: 'app_download', methods: ['POST'])]
|
||||
public function download(
|
||||
DownloadMediaInput $input,
|
||||
): Response {
|
||||
$this->bus->dispatch($input->toCommand());
|
||||
|
||||
return $this->json(['status' => 200, 'message' => 'Added to Queue']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user