feat: download ZIP archive of invoices with status 'paid'

This commit is contained in:
Björn Fromme
2025-01-31 18:08:52 +01:00
parent d39f75d831
commit 3f839f9082
9 changed files with 274 additions and 3 deletions
+20
View File
@@ -8,6 +8,7 @@ use App\Repository\Traits\QueryHelperTrait;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\Query;
use Doctrine\Persistence\ManagerRegistry;
use setasign\Fpdi\PdfParser\CrossReference\AbstractReader;
/**
* @extends ServiceEntityRepository<Upload>
@@ -79,6 +80,25 @@ class UploadRepository extends ServiceEntityRepository
return $data;
}
public function getBatchDownloadList(
string $type = Upload::TYPE_INVOICE,
string $status = Upload::STATUS_PAID
): array {
$qb = $this->createQueryBuilder('upload');
return $qb->where(
$qb->expr()->andX(
$qb->expr()->eq('upload.type', ':type'),
$qb->expr()->eq('upload.status', ':status'),
$qb->expr()->isNull('upload.downloadedAt'),
))
->setParameter('type', $type)
->setParameter('status', $status)
->getQuery()
->getResult()
;
}
public function getUploadListQuery(DocumentFilterDto $filterDto): Query
{
$qb = $this->createQueryBuilder('upload');