feat: pauses & resumes downloads

This commit is contained in:
2025-06-09 16:42:30 -05:00
parent a7bedae3db
commit 3c2092095f
12 changed files with 179 additions and 25 deletions

View File

@@ -6,7 +6,6 @@ use App\Download\Action\Command\PauseDownloadCommand;
use App\Download\Action\Result\PauseDownloadResult;
use App\Download\Framework\Entity\Download;
use App\Download\Framework\Repository\DownloadRepository;
use App\Monitor\Service\MediaFiles;
use OneToMany\RichBundle\Contract\CommandInterface;
use OneToMany\RichBundle\Contract\HandlerInterface;
use OneToMany\RichBundle\Contract\ResultInterface;
@@ -15,11 +14,8 @@ use Symfony\Contracts\Cache\CacheInterface;
/** @implements HandlerInterface<PauseDownloadCommand, PauseDownloadResult> */
readonly class PauseDownloadHandler implements HandlerInterface
{
const PAUSED_EXTENSION = '.paused';
public function __construct(
private DownloadRepository $downloadRepository,
private MediaFiles $mediaFiles,
private CacheInterface $cache,
) {}
@@ -32,8 +28,6 @@ readonly class PauseDownloadHandler implements HandlerInterface
return true;
});
$download->setFilename($download->getFilename() . self::PAUSED_EXTENSION);
return new PauseDownloadResult(200, 'Success', $download);
}
}