diff --git a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/operations.js b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/operations.js index 96cd3af5b0..d17423a13a 100644 --- a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/operations.js +++ b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/operations.js @@ -2,7 +2,7 @@ import { tooljetDatabaseService, authenticationService } from '@/_services'; import { isEmpty } from 'lodash'; import PostgrestQueryBuilder from '@/_helpers/postgrestQueryBuilder'; import { resolveReferences } from '@/_helpers/utils'; -import { hasEmptyStringOrNullValue } from './util'; +import { hasNullValueInFilters } from './util'; export const tooljetDbOperations = { perform, @@ -57,7 +57,7 @@ function buildPostgrestQuery(filters) { async function listRows(dataQuery, currentState) { const queryOptions = dataQuery.options; const resolvedOptions = resolveReferences(queryOptions, currentState); - if (hasEmptyStringOrNullValue(resolvedOptions, 'list_rows')) { + if (hasNullValueInFilters(resolvedOptions, 'list_rows')) { return { status: 'failed', statusText: 'failed', @@ -108,7 +108,7 @@ async function createRow(dataQuery, currentState) { async function updateRows(dataQuery, currentState) { const queryOptions = dataQuery.options; const resolvedOptions = resolveReferences(queryOptions, currentState); - if (hasEmptyStringOrNullValue(resolvedOptions, 'update_rows')) { + if (hasNullValueInFilters(resolvedOptions, 'update_rows')) { return { status: 'failed', statusText: 'failed', @@ -136,7 +136,7 @@ async function updateRows(dataQuery, currentState) { async function deleteRows(dataQuery, currentState) { const queryOptions = dataQuery.options; const resolvedOptions = resolveReferences(queryOptions, currentState); - if (hasEmptyStringOrNullValue(resolvedOptions, 'delete_rows')) { + if (hasNullValueInFilters(resolvedOptions, 'delete_rows')) { return { status: 'failed', statusText: 'failed', diff --git a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/util.js b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/util.js index cc2c86dfbf..e17035163d 100644 --- a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/util.js +++ b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/util.js @@ -3,7 +3,7 @@ import { get } from 'lodash'; /** * Checks if the queryOptions object contains a filter with an 'eq' (equal) operator and a value equal to '{{null}}'. * - * @function hasEmptyStringOrNullValue + * @function hasNullValueInFilters * @param {Object} queryOptions - The query options object to check for the presence of the specified filter. * @property {Object} queryOptions.list_rows.where_filters - An object containing the filters to be checked. * @returns {boolean} - Returns true if the specified filter is found, false otherwise. @@ -20,9 +20,9 @@ import { get } from 'lodash'; * }, * }; * - * const result = hasEmptyStringOrNullValue(queryOptions); // true + * const result = hasNullValueInFilters(queryOptions); // true */ -export const hasEmptyStringOrNullValue = (queryOptions, operation) => { +export const hasNullValueInFilters = (queryOptions, operation) => { const filters = get(queryOptions, `${operation}.where_filters`); if (filters) { const filterKeys = Object.keys(filters);