From 4d54ac8deef46be62111fcabdeba688b63a31f13 Mon Sep 17 00:00:00 2001 From: Leonardo <leomilho@gmail.com> Date: Sat, 8 Feb 2025 14:52:28 +0100 Subject: [PATCH] fix: use direction enum for relation parsing --- src/utils/cypher/converter/relation.ts | 1 + src/utils/reactflow/query2backend.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils/cypher/converter/relation.ts b/src/utils/cypher/converter/relation.ts index 0cc8da4..2912225 100644 --- a/src/utils/cypher/converter/relation.ts +++ b/src/utils/cypher/converter/relation.ts @@ -1,6 +1,7 @@ import type { RelationStruct } from 'ts-common'; import { getNodeCypher } from './node'; import type { QueryCacheData } from './model'; +import { log } from 'ts-common/src/logger/logger'; export const NoNodeError = new Error('relation must have a node'); diff --git a/src/utils/reactflow/query2backend.ts b/src/utils/reactflow/query2backend.ts index e0afe46..7b797d2 100644 --- a/src/utils/reactflow/query2backend.ts +++ b/src/utils/reactflow/query2backend.ts @@ -14,7 +14,7 @@ import type { } from 'ts-common/src/model/graphology'; import type { AllLogicStatement } from 'ts-common/src/model/query/logic/general'; import { QueryElementTypes } from 'ts-common/src/model/reactflow'; -import { type QueryBuilderSettings, QueryUnionType } from 'ts-common/src/model/query/queryBuilderModel'; +import { type QueryBuilderSettings, QueryRelationDirection, QueryUnionType } from 'ts-common/src/model/query/queryBuilderModel'; import { log } from '../../logger'; // Chunk extraction: traverse graph to find all paths of logic between relations and entities @@ -269,9 +269,9 @@ export function Query2BackendQuery( depth: _currNode.depth, direction: !_currNode.direction ? 'BOTH' - : _currNode.direction === 'right' + : _currNode.direction === QueryRelationDirection.RIGHT ? 'TO' - : _currNode.direction === 'left' + : _currNode.direction === QueryRelationDirection.LEFT ? 'FROM' : 'BOTH', node: chunk.length === position + 1 ? undefined : (processConnection(chunk, position + 1) as NodeStruct), -- GitLab