1
0
Fork 0
mirror of synced 2024-10-04 03:54:37 +13:00

Return full object from search

This commit is contained in:
Adria Navarro 2023-07-24 10:05:27 +02:00
parent 9cf401162b
commit 1cf4e6e85a
2 changed files with 6 additions and 6 deletions

View file

@ -155,7 +155,7 @@ export async function searchView(ctx: Ctx<void, SearchResponse>) {
}
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<void, SearchResponse>) {
datasourceId: view.tableId,
}
)
ctx.body = { rows }
}
export async function validate(ctx: Ctx) {

View file

@ -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 {