summaryrefslogtreecommitdiffstats
path: root/lib/Db
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Db')
-rw-r--r--lib/Db/ItemMapperV2.php15
-rw-r--r--lib/Db/ListType.php16
2 files changed, 18 insertions, 13 deletions
diff --git a/lib/Db/ItemMapperV2.php b/lib/Db/ItemMapperV2.php
index cfd30b75e..1ef9da244 100644
--- a/lib/Db/ItemMapperV2.php
+++ b/lib/Db/ItemMapperV2.php
@@ -12,6 +12,7 @@
namespace OCA\News\Db;
+use OC\DB\QueryBuilder\Literal;
use OCA\News\Service\Exceptions\ServiceValidationException;
use Doctrine\DBAL\FetchMode;
use OCA\News\Utility\Time;
@@ -386,12 +387,14 @@ class ItemMapperV2 extends NewsMapperV2
->addOrderBy('items.id', 'DESC');
switch ($feedType) {
- case FeedType::STARRED:
+ case ListType::STARRED:
$builder->andWhere('items.starred = 1');
break;
- case FeedType::UNREAD:
+ case ListType::UNREAD:
$builder->andWhere('items.unread = 1');
break;
+ case ListType::ALL_ITEMS:
+ break;
default:
throw new ServiceValidationException('Unexpected Feed type in call');
}
@@ -473,7 +476,7 @@ class ItemMapperV2 extends NewsMapperV2
if ($folderId === null) {
$folderWhere = $builder->expr()->isNull('feeds.folder_id');
} else {
- $folderWhere = $builder->expr()->eq('feeds.folder_id', $folderId);
+ $folderWhere = $builder->expr()->eq('feeds.folder_id', new Literal($folderId), IQueryBuilder::PARAM_INT);
}
$builder->select('items.*')
@@ -542,12 +545,14 @@ class ItemMapperV2 extends NewsMapperV2
}
switch ($type) {
- case FeedType::STARRED:
+ case ListType::STARRED:
$builder->andWhere('items.starred = 1');
break;
- case FeedType::UNREAD:
+ case ListType::UNREAD:
$builder->andWhere('items.unread = 1');
break;
+ case ListType::ALL_ITEMS:
+ break;
default:
throw new ServiceValidationException('Unexpected Feed type in call');
}
diff --git a/lib/Db/ListType.php b/lib/Db/ListType.php
index 1ccd592a8..e96e29ed6 100644
--- a/lib/Db/ListType.php
+++ b/lib/Db/ListType.php
@@ -18,13 +18,13 @@ namespace OCA\News\Db;
*
* @package OCA\News\Db
*/
-class FeedType
+class ListType
{
- const FEED = 0;
- const FOLDER = 1;
- const STARRED = 2;
- const SUBSCRIPTIONS = 3;
- const SHARED = 4;
- const EXPLORE = 5;
- const UNREAD = 6;
+ const FEED = 0;
+ const FOLDER = 1;
+ const STARRED = 2;
+ const ALL_ITEMS = 3;
+ const SHARED = 4;
+ const EXPLORE = 5;
+ const UNREAD = 6;
}