Return full object from search
This commit is contained in:
parent
9cf401162b
commit
1cf4e6e85a
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue