From 7465c0479913b8c23f6f9c666983ab76455c13a2 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 24 Jul 2023 16:35:22 +0200 Subject: [PATCH] Fix controller --- packages/server/src/api/controllers/row/index.ts | 6 ++++-- packages/server/src/api/routes/tests/row.spec.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/server/src/api/controllers/row/index.ts b/packages/server/src/api/controllers/row/index.ts index 79a1d54c63..6456d0def9 100644 --- a/packages/server/src/api/controllers/row/index.ts +++ b/packages/server/src/api/controllers/row/index.ts @@ -161,8 +161,10 @@ export async function searchView(ctx: Ctx) { const table = await sdk.tables.getTable(view?.tableId) const viewFields = - view.columns?.length && - Object.keys(sdk.views.enrichSchema(view, table.schema).schema) + (view.columns && + Object.entries(view.columns).length && + Object.keys(sdk.views.enrichSchema(view, table.schema).schema)) || + undefined ctx.status = 200 ctx.body = await quotas.addQuery( diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index e6be3a5cfc..e1dd11e6dd 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -856,7 +856,7 @@ describe("/rows", () => { } const createViewResponse = await config.api.viewV2.create({ - columns: ["name"], + columns: { name: { visible: true } }, }) const response = await config.api.viewV2.search(createViewResponse.id)