1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-06-27 16:36:00 +00:00

Merge pull request #7588 from KevinSJ/feat/filter-by-http-status

Add http_status filter to /api/entries
This commit is contained in:
Jérémy Benoist 2024-09-06 09:34:34 +02:00 committed by GitHub
commit 1b8960edc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 94 additions and 15 deletions

View file

@ -285,13 +285,14 @@ class EntryRepository extends ServiceEntityRepository
* @param string $tags
* @param string $detail 'metadata' or 'full'. Include content field if 'full'
* @param string $domainName
* @param int $httpStatus
* @param bool $isNotParsed
*
* @todo Breaking change: replace default detail=full by detail=metadata in a future version
*
* @return Pagerfanta
*/
public function findEntries($userId, $isArchived = null, $isStarred = null, $isPublic = null, $sort = 'created', $order = 'asc', $since = 0, $tags = '', $detail = 'full', $domainName = '', $isNotParsed = null)
public function findEntries($userId, $isArchived = null, $isStarred = null, $isPublic = null, $sort = 'created', $order = 'asc', $since = 0, $tags = '', $detail = 'full', $domainName = '', $isNotParsed = null, $httpStatus = null)
{
if (!\in_array(strtolower($detail), ['full', 'metadata'], true)) {
throw new \Exception('Detail "' . $detail . '" parameter is wrong, allowed: full or metadata');
@ -350,6 +351,10 @@ class EntryRepository extends ServiceEntityRepository
}
}
if (\is_int($httpStatus)) {
$qb->andWhere('e.httpStatus = :httpStatus')->setParameter('httpStatus', $httpStatus);
}
if (\is_string($domainName) && '' !== $domainName) {
$qb->andWhere('e.domainName = :domainName')->setParameter('domainName', $domainName);
}