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

feat: Implement http status filtering in entries API

This commit is contained in:
Kevin Jiang 2024-07-21 15:20:45 +12:00
parent 7a635c3b5a
commit c42a4a308f
2 changed files with 21 additions and 2 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);
}