diff --git a/packages/server/src/api/controllers/row/index.ts b/packages/server/src/api/controllers/row/index.ts index 62d81fb29e..5ffc91c102 100644 --- a/packages/server/src/api/controllers/row/index.ts +++ b/packages/server/src/api/controllers/row/index.ts @@ -155,7 +155,7 @@ export async function searchView(ctx: Ctx) { } ctx.status = 200 - const { rows } = await quotas.addQuery( + ctx.body = await quotas.addQuery( () => sdk.rows.search({ tableId: view.tableId, @@ -169,8 +169,6 @@ export async function searchView(ctx: Ctx) { datasourceId: view.tableId, } ) - - ctx.body = { rows } } export async function validate(ctx: Ctx) { diff --git a/packages/server/src/sdk/app/rows/search.ts b/packages/server/src/sdk/app/rows/search.ts index ab0723ab10..4937460686 100644 --- a/packages/server/src/sdk/app/rows/search.ts +++ b/packages/server/src/sdk/app/rows/search.ts @@ -34,13 +34,15 @@ function pickApi(tableId: any) { export async function search(options: SearchParams): Promise<{ rows: any[] + hasNextPage?: boolean + bookmark?: number | null }> { - let { rows } = await pickApi(options.tableId).search(options) + const result = await pickApi(options.tableId).search(options) if (options.fields) { - rows = rows.map((r: any) => _.pick(r, options.fields!)) + result.rows = result.rows.map((r: any) => _.pick(r, options.fields!)) } - return { rows } + return result } export interface ExportRowsParams {