api work, add account id, add "starred_only" switch
This commit is contained in:
parent
c2432a24aa
commit
0b8a2997fe
@ -1179,6 +1179,7 @@ QList<Message> DatabaseQueries::getArticlesSlice(const QSqlDatabase& db,
|
||||
int account_id,
|
||||
bool newest_first,
|
||||
bool unread_only,
|
||||
bool starred_only,
|
||||
qint64 start_after_article_date,
|
||||
int row_offset,
|
||||
int row_limit) {
|
||||
@ -1186,6 +1187,7 @@ QList<Message> DatabaseQueries::getArticlesSlice(const QSqlDatabase& db,
|
||||
QSqlQuery q(db);
|
||||
QString feed_clause = !feed_custom_id.isEmpty() ? QSL("Messages.feed = :feed AND") : QString();
|
||||
QString is_read_clause = unread_only ? QSL("Messages.is_read = :is_read AND ") : QString();
|
||||
QString is_starred_clause = starred_only ? QSL("Messages.is_important = :is_important AND ") : QString();
|
||||
QString account_id_clause = account_id > 0 ? QSL("Messages.account_id = :account_id AND ") : QString();
|
||||
QString date_created_clause;
|
||||
|
||||
@ -1206,6 +1208,7 @@ QList<Message> DatabaseQueries::getArticlesSlice(const QSqlDatabase& db,
|
||||
" %4 "
|
||||
" %5 "
|
||||
" %6 "
|
||||
" %7 "
|
||||
" Messages.is_deleted = 0 AND "
|
||||
" Messages.is_pdeleted = 0 "
|
||||
"ORDER BY Messages.date_created %2 "
|
||||
@ -1215,12 +1218,14 @@ QList<Message> DatabaseQueries::getArticlesSlice(const QSqlDatabase& db,
|
||||
feed_clause,
|
||||
date_created_clause,
|
||||
account_id_clause,
|
||||
is_read_clause));
|
||||
is_read_clause,
|
||||
is_starred_clause));
|
||||
q.bindValue(QSL(":account_id"), account_id);
|
||||
q.bindValue(QSL(":row_limit"), row_limit);
|
||||
q.bindValue(QSL(":row_offset"), row_offset);
|
||||
q.bindValue(QSL(":feed"), feed_custom_id);
|
||||
q.bindValue(QSL(":is_read"), 0);
|
||||
q.bindValue(QSL(":is_important"), 1);
|
||||
q.bindValue(QSL(":date_created"), start_after_article_date);
|
||||
|
||||
if (q.exec()) {
|
||||
|
@ -123,6 +123,7 @@ class DatabaseQueries {
|
||||
int account_id,
|
||||
bool newest_first,
|
||||
bool unread_only,
|
||||
bool starred_only,
|
||||
qint64 start_after_article_date,
|
||||
int row_offset,
|
||||
int row_limit);
|
||||
|
@ -117,8 +117,9 @@ ApiResponse ApiServer::processArticlesFromFeed(const QJsonValue& req) const {
|
||||
int account_id = data.value(QSL("account")).toInt();
|
||||
bool newest_first = data.value(QSL("newest_first")).toBool();
|
||||
bool unread_only = data.value(QSL("unread_only")).toBool();
|
||||
bool starred_only = data.value(QSL("starred_only")).toBool();
|
||||
int row_offset = data.value(QSL("row_offset")).toInt();
|
||||
int row_limit = data.value(QSL("row_limit")).toInt();
|
||||
int row_limit = data.value(QSL("row_limit")).toInt(100000);
|
||||
|
||||
// NOTE: Fixup arguments.
|
||||
if (feed_id == QSL("0")) {
|
||||
@ -131,6 +132,7 @@ ApiResponse ApiServer::processArticlesFromFeed(const QJsonValue& req) const {
|
||||
account_id,
|
||||
newest_first,
|
||||
unread_only,
|
||||
starred_only,
|
||||
start_after_article_date,
|
||||
row_offset,
|
||||
row_limit);
|
||||
|
Loading…
x
Reference in New Issue
Block a user