From 1edc525d9b548da6fd58e8a17b45b29ce4c62104 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Fri, 3 May 2024 17:31:44 +0100 Subject: [PATCH] Fix boolean searching for external datasources. --- .../server/src/api/controllers/row/utils/utils.ts | 6 +----- packages/server/src/api/routes/tests/search.spec.ts | 13 ++++++------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/server/src/api/controllers/row/utils/utils.ts b/packages/server/src/api/controllers/row/utils/utils.ts index d6113d8b7e..afee5a9475 100644 --- a/packages/server/src/api/controllers/row/utils/utils.ts +++ b/packages/server/src/api/controllers/row/utils/utils.ts @@ -175,11 +175,7 @@ export async function sqlOutputProcessing( throw new Error("Unable to generate row ID for SQL rows") } - if (opts?.sqs) { - finalRows[thisRow._id] = fixBooleanFields({ row: thisRow, table }) - } else { - finalRows[thisRow._id] = thisRow - } + finalRows[thisRow._id] = fixBooleanFields({ row: thisRow, table }) // do this at end once its been added to the final rows finalRows = await updateRelationshipColumns( diff --git a/packages/server/src/api/routes/tests/search.spec.ts b/packages/server/src/api/routes/tests/search.spec.ts index b38f187404..6b926c9a4e 100644 --- a/packages/server/src/api/routes/tests/search.spec.ts +++ b/packages/server/src/api/routes/tests/search.spec.ts @@ -15,17 +15,16 @@ import { TableSchema, } from "@budibase/types" import _ from "lodash" -import exp from "constants" jest.unmock("mssql") describe.each([ - // ["lucene", undefined], + ["lucene", undefined], ["sqs", undefined], - // [DatabaseName.POSTGRES, getDatasource(DatabaseName.POSTGRES)], - // [DatabaseName.MYSQL, getDatasource(DatabaseName.MYSQL)], - // [DatabaseName.SQL_SERVER, getDatasource(DatabaseName.SQL_SERVER)], - // [DatabaseName.MARIADB, getDatasource(DatabaseName.MARIADB)], + [DatabaseName.POSTGRES, getDatasource(DatabaseName.POSTGRES)], + [DatabaseName.MYSQL, getDatasource(DatabaseName.MYSQL)], + [DatabaseName.SQL_SERVER, getDatasource(DatabaseName.SQL_SERVER)], + [DatabaseName.MARIADB, getDatasource(DatabaseName.MARIADB)], ])("/api/:sourceId/search (%s)", (name, dsProvider) => { const isSqs = name === "sqs" const isLucene = name === "lucene" @@ -167,7 +166,7 @@ describe.each([ return expectSearch({ query }) } - describe.only("boolean", () => { + describe("boolean", () => { beforeAll(async () => { await createTable({ isTrue: { name: "isTrue", type: FieldType.BOOLEAN },