mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-27 03:21:01 +00:00
for GET /api/entries, star, delete and archive status are no more necessary
This commit is contained in:
parent
42a9064620
commit
6e334aba68
3 changed files with 16 additions and 11 deletions
|
@ -18,7 +18,6 @@ class StaticController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Route("/", name="homepage")
|
||||
*/
|
||||
|
|
|
@ -33,9 +33,9 @@ class WallabagRestController extends Controller
|
|||
{
|
||||
// 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', 0);
|
||||
$isStarred = $request->query->get('star', 0);
|
||||
$isDeleted = $request->query->get('delete', 0);
|
||||
$isArchived = $request->query->get('archive');
|
||||
$isStarred = $request->query->get('star');
|
||||
$isDeleted = $request->query->get('delete');
|
||||
$sort = $request->query->get('sort', 'created');
|
||||
$order = $request->query->get('order', 'desc');
|
||||
$page = $request->query->get('page', 1);
|
||||
|
@ -45,7 +45,7 @@ class WallabagRestController extends Controller
|
|||
$entries = $this
|
||||
->getDoctrine()
|
||||
->getRepository('WallabagCoreBundle:Entries')
|
||||
->findEntries(1, (int) $isArchived, (int) $isStarred, (int) $isDeleted, $sort, $order);
|
||||
->findEntries(1, $isArchived, $isStarred, $isDeleted, $sort, $order);
|
||||
|
||||
if (!is_array($entries)) {
|
||||
throw $this->createNotFoundException();
|
||||
|
|
|
@ -86,13 +86,19 @@ class EntriesRepository extends EntityRepository
|
|||
//TODO tous les paramètres ne sont pas utilisés, à corriger
|
||||
$qb = $this->createQueryBuilder('e')
|
||||
->select('e')
|
||||
->where('e.isFav =:isStarred')->setParameter('isStarred', $isStarred)
|
||||
->andWhere('e.isRead =:isArchived')->setParameter('isArchived', $isArchived)
|
||||
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
|
||||
->andWhere('e.isDeleted=0')
|
||||
->where('e.userId =:userId')->setParameter('userId', $userId)
|
||||
->andWhere('e.isDeleted=0');
|
||||
|
||||
if (!is_null($isArchived)) {
|
||||
$qb->andWhere('e.isRead =:isArchived')->setParameter('isArchived', $isArchived);
|
||||
}
|
||||
|
||||
if (!is_null($isStarred)) {
|
||||
$qb->andWhere('e.isFav =:isStarred')->setParameter('isStarred', $isStarred);
|
||||
}
|
||||
|
||||
return $qb
|
||||
->getQuery()
|
||||
->getResult(Query::HYDRATE_ARRAY);
|
||||
|
||||
return $qb;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue