@@ -72,8 +72,8 @@ open class ProjectionBase {
7272
7373 val filteredArguments = field.arguments.filterNot { setOf (FIRST , OFFSET , ORDER_BY , FILTER ).contains(it.name) }
7474
75- val parsedQuery = parseArguments(filteredArguments, fieldDefinition, type)
76- val result = handleQuery(variable, " " , propertyContainer, parsedQuery, type)
75+ val parsedQuery = parseArguments(filteredArguments, fieldDefinition, type, variables )
76+ val result = handleQuery(variable, " " , propertyContainer, parsedQuery, type, variables )
7777
7878 return field.arguments.find { FILTER == it.name }
7979 ?.let { arg ->
@@ -83,9 +83,9 @@ open class ProjectionBase {
8383 else -> throw IllegalArgumentException (" " )
8484 }
8585 }
86- ?.let { parseFilter(it as ObjectValue , type) }
86+ ?.let { parseFilter(it as ObjectValue , type, variables ) }
8787 ?.let {
88- val filterCondition = handleQuery(normalizeName(FILTER , variable), " " , propertyContainer, it, type)
88+ val filterCondition = handleQuery(normalizeName(FILTER , variable), " " , propertyContainer, it, type, variables )
8989 result.and (filterCondition)
9090 }
9191 ? : result
@@ -96,7 +96,8 @@ open class ProjectionBase {
9696 variableSuffix : String ,
9797 propertyContainer : PropertyContainer ,
9898 parsedQuery : ParsedQuery ,
99- type : GraphQLFieldsContainer
99+ type : GraphQLFieldsContainer ,
100+ variables : Map <String , Any >
100101 ): Condition {
101102 var result = parsedQuery.getFieldConditions(propertyContainer, variablePrefix, variableSuffix)
102103
@@ -122,8 +123,8 @@ open class ProjectionBase {
122123 else -> null
123124 }?.let {
124125 val targetNode = predicate.relNode.named(normalizeName(variablePrefix, predicate.relationshipInfo.typeName))
125- val parsedQuery2 = parseFilter(objectField.value as ObjectValue , type)
126- val condition = handleQuery(targetNode.requiredSymbolicName.value, " " , targetNode, parsedQuery2, type)
126+ val parsedQuery2 = parseFilter(objectField.value as ObjectValue , type, variables )
127+ val condition = handleQuery(targetNode.requiredSymbolicName.value, " " , targetNode, parsedQuery2, type, variables )
127128 var where = it
128129 .`in `(listBasedOn(predicate.relationshipInfo.createRelation(propertyContainer as Node , targetNode)).returning(condition))
129130 .where(cond.asCondition())
@@ -135,19 +136,19 @@ open class ProjectionBase {
135136 }
136137 }
137138
138- fun handleLogicalOperator (value : Value <* >, classifier : String ): Condition {
139+ fun handleLogicalOperator (value : Value <* >, classifier : String , variables : Map < String , Any > ): Condition {
139140 val objectValue = value as ? ObjectValue
140141 ? : throw IllegalArgumentException (" Only object values are supported for logical operations, but got ${value.javaClass.name} " )
141142
142- val parsedNestedQuery = parseFilter(objectValue, type)
143- return handleQuery(variablePrefix + classifier, variableSuffix, propertyContainer, parsedNestedQuery, type)
143+ val parsedNestedQuery = parseFilter(objectValue, type, variables )
144+ return handleQuery(variablePrefix + classifier, variableSuffix, propertyContainer, parsedNestedQuery, type, variables )
144145 }
145146
146147 fun handleLogicalOperators (values : List <Value <* >>? , classifier : String ): List <Condition > {
147148 return when {
148149 values?.isNotEmpty() == true -> when {
149- values.size > 1 -> values.mapIndexed { index, value -> handleLogicalOperator(value, " ${classifier}${index + 1 } " ) }
150- else -> values.map { value -> handleLogicalOperator(value, " " ) }
150+ values.size > 1 -> values.mapIndexed { index, value -> handleLogicalOperator(value, " ${classifier}${index + 1 } " , variables ) }
151+ else -> values.map { value -> handleLogicalOperator(value, " " , variables ) }
151152 }
152153 else -> emptyList()
153154 }
0 commit comments