mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-05 22:38:48 +00:00
rename function name for null check
This commit is contained in:
parent
ef4082a1f7
commit
646eb864b3
2 changed files with 7 additions and 7 deletions
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue