Fix bug items sync for the Fever api

This commit is contained in:
Frédéric Guillot 2014-11-08 22:33:50 -05:00
parent 906f99cf1c
commit 4fa894925e

View File

@ -128,38 +128,27 @@ route('items', function() {
if ($response['auth']) { if ($response['auth']) {
$offset = 0; $query = Database::get('db')
$direction = 'ASC'; ->table('items')
->limit(50)
->columns(
'rowid',
'feed_id',
'title',
'author',
'content',
'url',
'updated',
'status',
'bookmark'
);
if (isset($_GET['since_id']) && is_numeric($_GET['since_id'])) { if (isset($_GET['since_id']) && is_numeric($_GET['since_id'])) {
$offset = $_GET['since_id']; $items = $query->gt('rowid', $_GET['since_id'])
$direction = 'ASC'; ->asc('rowid');
} }
else if (isset($_GET['max_id']) && is_numeric($_GET['max_id'])) { else if (! empty($_GET['with_ids'])) {
$offset = $_GET['max_id'];
$direction = 'DESC';
}
$query = Database::get('db')
->table('items')
->columns(
'rowid',
'feed_id',
'title',
'author',
'content',
'url',
'updated',
'status',
'bookmark'
)
->orderby('rowid', $direction)
->offset($offset)
->limit(50);
if (! empty($_GET['with_ids'])) {
$query->in('rowid', explode(',', $_GET['with_ids'])); $query->in('rowid', explode(',', $_GET['with_ids']));
} }