Fix build on view search

This commit is contained in:
Adria Navarro 2024-08-06 08:15:30 +02:00
parent 98d9f52f66
commit 1e6bb7ebd7
1 changed files with 10 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import {
RequiredKeys,
RowSearchParams,
SearchFilterKey,
LogicalOperator,
} from "@budibase/types"
import { dataFilters } from "@budibase/shared-core"
import sdk from "../../../sdk"
@ -48,9 +49,17 @@ export async function searchView(
// Carry over filters for unused fields
Object.keys(body.query).forEach(key => {
const operator = key as SearchFilterKey
Object.keys(body.query[operator] || {}).forEach(field => {
if (!existingFields.includes(db.removeKeyNumbering(field))) {
query[operator]![field] = body.query[operator]![field]
if (
operator === LogicalOperator.AND ||
operator === LogicalOperator.OR
) {
// TODO
} else {
query[operator]![field] = body.query[operator]![field]
}
}
})
})