diff --git a/app/services/namespaces/projects/flows/create_service.rb b/app/services/namespaces/projects/flows/create_service.rb index 37f23e5c..1a31b957 100644 --- a/app/services/namespaces/projects/flows/create_service.rb +++ b/app/services/namespaces/projects/flows/create_service.rb @@ -132,6 +132,9 @@ def create_node_function(node_function_id, input_nodes, t) next end + # This will be broken, because we cant reference nodes that arent created yet + # And we will need to put all parameter nodes inside the flowinput.nodes + # So we can reference them here because we will not recursively search for them referenced_node = NodeFunction.joins(:runtime_function).find_by( id: parameter.value.reference_value.node_function_id.model_id, runtime_function_definitions: { runtime_id: namespace_project.primary_runtime.id } diff --git a/app/services/namespaces/projects/flows/update_service.rb b/app/services/namespaces/projects/flows/update_service.rb index 82e60da2..957ca08e 100644 --- a/app/services/namespaces/projects/flows/update_service.rb +++ b/app/services/namespaces/projects/flows/update_service.rb @@ -192,6 +192,9 @@ def update_node_parameters(t, current_node, current_node_input, all_nodes) t ) + # This will be broken, because we cant reference nodes that arent created yet + # And we will need to put all parameter nodes inside the flowinput.nodes + # So we can reference them here because we will not recursively search for them referenced_node = NodeFunction.joins(:runtime_function).find_by( id: parameter.value.reference_value.node_function_id.model_id, runtime_function_definitions: { runtime_id: flow.project.primary_runtime.id } diff --git a/spec/requests/graphql/mutation/namespace/projects/flows/create_mutation_spec.rb b/spec/requests/graphql/mutation/namespace/projects/flows/create_mutation_spec.rb index 2408ff1c..4f1c36ea 100644 --- a/spec/requests/graphql/mutation/namespace/projects/flows/create_mutation_spec.rb +++ b/spec/requests/graphql/mutation/namespace/projects/flows/create_mutation_spec.rb @@ -59,7 +59,7 @@ flow: { name: generate(:flow_name), type: flow_type.to_global_id.to_s, - startingNodeId: 'gid://sagittarius/NodeFunction/999', + startingNodeId: 'gid://sagittarius/NodeFunction/1000', settings: { flowSettingIdentifier: 'key', value: { @@ -68,23 +68,46 @@ }, nodes: [ { - id: 'gid://sagittarius/NodeFunction/999', + id: 'gid://sagittarius/NodeFunction/1000', runtimeFunctionId: runtime_function.to_global_id.to_s, parameters: [ runtimeParameterDefinitionId: runtime_function.parameters.first.to_global_id.to_s, value: { - literalValue: 'test_value', + functionValue: { + id: 'gid://sagittarius/NodeFunction/2000', + runtimeFunctionId: runtime_function.to_global_id.to_s, + nextNodeId: nil, + parameters: [ + { + runtimeParameterDefinitionId: runtime_function.parameters.first.to_global_id.to_s, + value: { + literalValue: 100, + }, + } + ], + }, } ], - nextNodeId: 'gid://sagittarius/NodeFunction/991', + nextNodeId: 'gid://sagittarius/NodeFunction/1001', }, { - id: 'gid://sagittarius/NodeFunction/991', + id: 'gid://sagittarius/NodeFunction/1001', runtimeFunctionId: runtime_function.to_global_id.to_s, parameters: [ runtimeParameterDefinitionId: runtime_function.parameters.first.to_global_id.to_s, value: { - literalValue: 'test_value2', + # https://github.com/code0-tech/sagittarius/issues/756 + literalValue: 42, + # referenceValue: { + # depth: 1, + # node: 1, + # scope: [], + # referencePath: [], + # nodeFunctionId: 'gid://sagittarius/NodeFunction/2000', + # dataTypeIdentifier: { + # genericKey: 'K', + # }, + # }, } ], }