1
0
Fork 0
mirror of synced 2024-07-16 03:35:56 +12:00

Merge branch 'lab-day-search' of github.com:Budibase/budibase into lab-day-search

This commit is contained in:
Andrew Kingston 2021-05-12 14:52:56 +01:00
commit ad9c4ef406

View file

@ -1,4 +1,6 @@
const { QueryBuilder, buildSearchUrl, search } = require("./utils") const { QueryBuilder, buildSearchUrl, search } = require("./utils")
const CouchDB = require("../../../db")
const { outputProcessing } = require("../../../utilities/rowProcessor")
exports.rowSearch = async ctx => { exports.rowSearch = async ctx => {
const appId = ctx.appId const appId = ctx.appId
@ -12,6 +14,8 @@ exports.rowSearch = async ctx => {
sortOrder, sortOrder,
sortType, sortType,
} = ctx.request.body } = ctx.request.body
const db = new CouchDB(appId)
let url let url
if (query) { if (query) {
url = new QueryBuilder( url = new QueryBuilder(
@ -32,5 +36,10 @@ exports.rowSearch = async ctx => {
bookmark, bookmark,
}) })
} }
ctx.body = await search(url) const response = await search(url)
const table = await db.get(tableId)
ctx.body = {
rows: await outputProcessing(appId, table, response.rows),
bookmark: response.bookmark,
}
} }