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
|
undefined
|
||||||
|
|
||||||
ctx.status = 200
|
ctx.status = 200
|
||||||
ctx.body = await quotas.addQuery(
|
const result = await quotas.addQuery(
|
||||||
() =>
|
() =>
|
||||||
sdk.rows.search({
|
sdk.rows.search({
|
||||||
tableId: view.tableId,
|
tableId: view.tableId,
|
||||||
|
@ -281,6 +281,9 @@ export async function searchView(ctx: Ctx<void, SearchResponse>) {
|
||||||
datasourceId: view.tableId,
|
datasourceId: view.tableId,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
result.rows.forEach(r => (r._viewId = view.id))
|
||||||
|
ctx.body = result
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function validate(ctx: Ctx) {
|
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 } },
|
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).toHaveLength(10)
|
||||||
expect(response.body.rows).toEqual(
|
expect(response.body.rows).toEqual(
|
||||||
expect.arrayContaining(
|
expect.arrayContaining(
|
||||||
rows.map(r => ({
|
rows.map(r => ({
|
||||||
...expectAnyInternalColsAttributes,
|
...expectAnyInternalColsAttributes,
|
||||||
|
_viewId: view.id,
|
||||||
name: r.name,
|
name: r.name,
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue