Entry: add sort parameter archived

This commit is contained in:
Sébastien Viande 2018-04-26 07:20:52 +02:00 committed by Jeremy Benoist
parent 7975395d10
commit 0e70e81227
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
2 changed files with 3 additions and 1 deletions

View file

@ -79,7 +79,7 @@ class EntryRestController extends WallabagRestController
* parameters={
* {"name"="archive", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by archived status."},
* {"name"="starred", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by starred status."},
* {"name"="sort", "dataType"="string", "required"=false, "format"="'created' or 'updated', default 'created'", "description"="sort entries by date."},
* {"name"="sort", "dataType"="string", "required"=false, "format"="'created' or 'updated' or 'archived', default 'created'", "description"="sort entries by date."},
* {"name"="order", "dataType"="string", "required"=false, "format"="'asc' or 'desc', default 'desc'", "description"="order of sort."},
* {"name"="page", "dataType"="integer", "required"=false, "format"="default '1'", "description"="what page you want."},
* {"name"="perPage", "dataType"="integer", "required"=false, "format"="default'30'", "description"="results per page."},

View file

@ -189,6 +189,8 @@ class EntryRepository extends EntityRepository
$qb->orderBy('e.id', $order);
} elseif ('updated' === $sort) {
$qb->orderBy('e.updatedAt', $order);
} else if ('archived' === $sort) {
$qb->orderBy('e.archivedAt', $order);
}
$pagerAdapter = new DoctrineORMAdapter($qb, true, false);