Return top level pagination info from query execution

This commit is contained in:
Andrew Kingston 2021-12-17 19:00:23 +00:00
parent 5aaacf19bf
commit 3830aeba8f
1 changed files with 2 additions and 2 deletions

View File

@ -139,7 +139,7 @@ async function execute(ctx, opts = { rowsOnly: false }) {
// call the relevant CRUD method on the integration class // call the relevant CRUD method on the integration class
try { try {
const { rows, extra } = await Runner.run({ const { rows, pagination, extra } = await Runner.run({
appId: ctx.appId, appId: ctx.appId,
datasource, datasource,
queryVerb: query.queryVerb, queryVerb: query.queryVerb,
@ -151,7 +151,7 @@ async function execute(ctx, opts = { rowsOnly: false }) {
if (opts && opts.rowsOnly) { if (opts && opts.rowsOnly) {
ctx.body = rows ctx.body = rows
} else { } else {
ctx.body = { data: rows, ...extra } ctx.body = { data: rows, pagination, ...extra }
} }
} catch (err) { } catch (err) {
ctx.throw(400, err) ctx.throw(400, err)