Add limit transform
parent
994320f78e
commit
66f479844e
|
@ -87,6 +87,12 @@ class ApiController extends Controller {
|
||||||
$transforms[] = array($this->timelineQuery, 'transformTagFilter', $tagName);
|
$transforms[] = array($this->timelineQuery, 'transformTagFilter', $tagName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Limit number of responses for day query
|
||||||
|
$limit = $this->request->getParam('limit');
|
||||||
|
if ($limit) {
|
||||||
|
$transforms[] = array($this->timelineQuery, 'transformLimitDay', intval($limit));
|
||||||
|
}
|
||||||
|
|
||||||
return $transforms;
|
return $transforms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,4 +44,8 @@ trait TimelineQueryFilters {
|
||||||
public function transformVideoFilter(IQueryBuilder &$query, string $userId) {
|
public function transformVideoFilter(IQueryBuilder &$query, string $userId) {
|
||||||
$query->andWhere($query->expr()->eq('m.isvideo', $query->createNamedParameter('1')));
|
$query->andWhere($query->expr()->eq('m.isvideo', $query->createNamedParameter('1')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function transformLimitDay(IQueryBuilder &$query, string $userId, int $limit) {
|
||||||
|
$query->setMaxResults($limit);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue