1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-02-01 19:15:01 +02:00

API: Always include 'has_more' field for paginated data

This commit is contained in:
Laurent Cozic 2020-11-19 16:25:32 +00:00
parent 61618fb37c
commit 30913a5d58

View File

@ -3,7 +3,7 @@ import { Pagination, PaginationOrder } from './types';
export interface ModelFeedPage { export interface ModelFeedPage {
items: any[]; items: any[];
has_more?: boolean; has_more: boolean;
total?: number; total?: number;
} }
@ -52,9 +52,8 @@ export default async function(db: any, tableName: string, pagination: Pagination
const rows = await db.selectAll(sql, sqlParams); const rows = await db.selectAll(sql, sqlParams);
const output: ModelFeedPage = { items: rows }; return {
items: rows,
if (rows.length >= pagination.limit) output.has_more = true; has_more: rows.length >= pagination.limit,
};
return output;
} }