mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-28 10:30:28 +00:00
change delete status for GET /api/entries method
This commit is contained in:
parent
6e334aba68
commit
6079aaa33d
2 changed files with 8 additions and 7 deletions
|
@ -17,8 +17,8 @@ class WallabagRestController extends Controller
|
|||
*
|
||||
* @ApiDoc(
|
||||
* parameters={
|
||||
* {"name"="archive", "dataType"="integer", "required"=false, "format"="'0' or '1', default '0'", "description"="filter by archived status."},
|
||||
* {"name"="star", "dataType"="integer", "required"=false, "format"="'0' or '1', default '0'", "description"="filter by starred status."},
|
||||
* {"name"="archive", "dataType"="integer", "required"=false, "format"="'0' or '1', all entries by default", "description"="filter by archived status."},
|
||||
* {"name"="star", "dataType"="integer", "required"=false, "format"="'0' or '1', all entries by default", "description"="filter by starred status."},
|
||||
* {"name"="delete", "dataType"="integer", "required"=false, "format"="'0' or '1', default '0'", "description"="filter by deleted status."},
|
||||
* {"name"="sort", "dataType"="string", "required"=false, "format"="'created' or 'updated', default 'created'", "description"="sort entries by date."},
|
||||
* {"name"="order", "dataType"="string", "required"=false, "format"="'asc' or 'desc', default 'desc'", "description"="order of sort."},
|
||||
|
@ -31,11 +31,9 @@ class WallabagRestController extends Controller
|
|||
*/
|
||||
public function getEntriesAction(Request $request)
|
||||
{
|
||||
// TODO isArchived, isStarred et isDeleted ne doivent pas avoir de valeur par défaut
|
||||
// TODO Si on ne passe rien, on ne filtre pas sur le statut.
|
||||
$isArchived = $request->query->get('archive');
|
||||
$isStarred = $request->query->get('star');
|
||||
$isDeleted = $request->query->get('delete');
|
||||
$isDeleted = $request->query->get('delete', 0);
|
||||
$sort = $request->query->get('sort', 'created');
|
||||
$order = $request->query->get('order', 'desc');
|
||||
$page = $request->query->get('page', 1);
|
||||
|
|
|
@ -86,8 +86,7 @@ class EntriesRepository extends EntityRepository
|
|||
//TODO tous les paramètres ne sont pas utilisés, à corriger
|
||||
$qb = $this->createQueryBuilder('e')
|
||||
->select('e')
|
||||
->where('e.userId =:userId')->setParameter('userId', $userId)
|
||||
->andWhere('e.isDeleted=0');
|
||||
->where('e.userId =:userId')->setParameter('userId', $userId);
|
||||
|
||||
if (!is_null($isArchived)) {
|
||||
$qb->andWhere('e.isRead =:isArchived')->setParameter('isArchived', $isArchived);
|
||||
|
@ -97,6 +96,10 @@ class EntriesRepository extends EntityRepository
|
|||
$qb->andWhere('e.isFav =:isStarred')->setParameter('isStarred', $isStarred);
|
||||
}
|
||||
|
||||
if (!is_null($isDeleted)) {
|
||||
$qb->andWhere('e.isDeleted =:isDeleted')->setParameter('isDeleted', $isDeleted);
|
||||
}
|
||||
|
||||
return $qb
|
||||
->getQuery()
|
||||
->getResult(Query::HYDRATE_ARRAY);
|
||||
|
|
Loading…
Reference in a new issue