From a05fae13dcca10fd74ee97b361d9b87afec90901 Mon Sep 17 00:00:00 2001 From: Christina Papadogianni <59121443+ChrisPdgn@users.noreply.github.com> Date: Fri, 5 May 2023 18:37:08 +0300 Subject: [PATCH] fix(database): fix custom endpoints check (#618) --- modules/database/src/admin/customEndpoints/utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/database/src/admin/customEndpoints/utils.ts b/modules/database/src/admin/customEndpoints/utils.ts index 0fba8fec6..13756bb0f 100644 --- a/modules/database/src/admin/customEndpoints/utils.ts +++ b/modules/database/src/admin/customEndpoints/utils.ts @@ -1,5 +1,5 @@ import { ConduitModel, GrpcError, Indexable, TYPE } from '@conduitplatform/grpc-sdk'; -import { isNil, isPlainObject } from 'lodash'; +import { isNil, isPlainObject, get } from 'lodash'; import { status } from '@grpc/grpc-js'; import { LocationEnum, OperationsEnum } from '../../enums'; import { ICustomEndpoint } from '../../interfaces'; @@ -94,7 +94,7 @@ function _queryValidation( return 'comparisonField cannot be empty and should contain type and value'; } - if (!Object.keys(fields).includes(schemaField)) { + if (!get(fields, schemaField)) { return 'schemaField is not present/accessible in selected schema!'; } @@ -226,7 +226,7 @@ export function assignmentValidation( return 'assignmentField cannot be empty and should contain type and value'; } - if (!Object.keys(fields).includes(schemaField)) { + if (!get(fields, schemaField)) { return 'schemaField is not present/accessible in selected schema!'; }