Return _viewId when searching
This commit is contained in:
parent
2c6725404f
commit
b69e18ab70
|
@ -269,7 +269,7 @@ export async function searchView(ctx: Ctx<void, SearchResponse>) {
|
|||
undefined
|
||||
|
||||
ctx.status = 200
|
||||
ctx.body = await quotas.addQuery(
|
||||
const result = await quotas.addQuery(
|
||||
() =>
|
||||
sdk.rows.search({
|
||||
tableId: view.tableId,
|
||||
|
@ -281,6 +281,9 @@ export async function searchView(ctx: Ctx<void, SearchResponse>) {
|
|||
datasourceId: view.tableId,
|
||||
}
|
||||
)
|
||||
|
||||
result.rows.forEach(r => (r._viewId = view.id))
|
||||
ctx.body = result
|
||||
}
|
||||
|
||||
export async function validate(ctx: Ctx) {
|
||||
|
|
|
@ -986,16 +986,17 @@ describe("/rows", () => {
|
|||
)
|
||||
}
|
||||
|
||||
const createViewResponse = await config.api.viewV2.create({
|
||||
const view = await config.api.viewV2.create({
|
||||
columns: { name: { visible: true } },
|
||||
})
|
||||
const response = await config.api.viewV2.search(createViewResponse.id)
|
||||
const response = await config.api.viewV2.search(view.id)
|
||||
|
||||
expect(response.body.rows).toHaveLength(10)
|
||||
expect(response.body.rows).toEqual(
|
||||
expect.arrayContaining(
|
||||
rows.map(r => ({
|
||||
...expectAnyInternalColsAttributes,
|
||||
_viewId: view.id,
|
||||
name: r.name,
|
||||
}))
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue