From a65a6d5d6670fd7396d21f101ecb547ba30d5261 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 2 Jun 2026 17:31:03 +0200 Subject: [PATCH] fix: correct mutation connection --- .../update_module_configurations.rb | 8 +++--- .../update_module_configurations_service.rb | 2 +- ...meassignmentsupdatemoduleconfigurations.md | 2 +- ...ate_module_configurations_mutation_spec.rb | 28 ++++++------------- ...date_module_configurations_service_spec.rb | 2 +- 5 files changed, 16 insertions(+), 26 deletions(-) diff --git a/app/graphql/mutations/namespaces/projects/runtime_assignments/update_module_configurations.rb b/app/graphql/mutations/namespaces/projects/runtime_assignments/update_module_configurations.rb index 91ceceb84..e39feed02 100644 --- a/app/graphql/mutations/namespaces/projects/runtime_assignments/update_module_configurations.rb +++ b/app/graphql/mutations/namespaces/projects/runtime_assignments/update_module_configurations.rb @@ -15,16 +15,16 @@ class UpdateModuleConfigurations < BaseMutation required: true, description: 'The project runtime assignment to update.' - field :namespace_project_runtime_assignment, Types::NamespaceProjectRuntimeAssignmentType, + field :module_configurations, [Types::ModuleConfigurationType], null: true, - description: 'The updated project runtime assignment.' + description: 'The updated module configurations.' def resolve(namespace_project_runtime_assignment_id:, module_configurations:) runtime_assignment = SagittariusSchema.object_from_id(namespace_project_runtime_assignment_id) if runtime_assignment.nil? return { - namespace_project_runtime_assignment: nil, + module_configurations: nil, errors: [create_error(:runtime_not_assigned, 'Invalid project runtime assignment')], } end @@ -33,7 +33,7 @@ def resolve(namespace_project_runtime_assignment_id:, module_configurations:) current_authentication, runtime_assignment, module_configurations - ).execute.to_mutation_response(success_key: :namespace_project_runtime_assignment) + ).execute.to_mutation_response(success_key: :module_configurations) end end end diff --git a/app/services/namespaces/projects/runtime_assignments/update_module_configurations_service.rb b/app/services/namespaces/projects/runtime_assignments/update_module_configurations_service.rb index 32106e1fa..b5687f7dc 100644 --- a/app/services/namespaces/projects/runtime_assignments/update_module_configurations_service.rb +++ b/app/services/namespaces/projects/runtime_assignments/update_module_configurations_service.rb @@ -42,7 +42,7 @@ def execute } ) - ServiceResponse.success(message: 'Updated module configurations', payload: runtime_assignment) + ServiceResponse.success(message: 'Updated module configurations', payload: db_configurations) end return response if response.error? diff --git a/docs/graphql/mutation/namespacesprojectsruntimeassignmentsupdatemoduleconfigurations.md b/docs/graphql/mutation/namespacesprojectsruntimeassignmentsupdatemoduleconfigurations.md index 014f999f3..1942953a0 100644 --- a/docs/graphql/mutation/namespacesprojectsruntimeassignmentsupdatemoduleconfigurations.md +++ b/docs/graphql/mutation/namespacesprojectsruntimeassignmentsupdatemoduleconfigurations.md @@ -18,4 +18,4 @@ Updates the saved module configurations for a project runtime assignment. |------|------|-------------| | `clientMutationId` | [`String`](../scalar/string.md) | A unique identifier for the client performing the mutation. | | `errors` | [`[Error!]!`](../object/error.md) | Errors encountered during execution of the mutation. | -| `namespaceProjectRuntimeAssignment` | [`NamespaceProjectRuntimeAssignment`](../object/namespaceprojectruntimeassignment.md) | The updated project runtime assignment. | +| `moduleConfigurations` | [`[ModuleConfiguration!]`](../object/moduleconfiguration.md) | The updated module configurations. | diff --git a/spec/requests/graphql/mutation/namespace/projects/runtime_assignments/update_module_configurations_mutation_spec.rb b/spec/requests/graphql/mutation/namespace/projects/runtime_assignments/update_module_configurations_mutation_spec.rb index 1718df3af..961e0fd51 100644 --- a/spec/requests/graphql/mutation/namespace/projects/runtime_assignments/update_module_configurations_mutation_spec.rb +++ b/spec/requests/graphql/mutation/namespace/projects/runtime_assignments/update_module_configurations_mutation_spec.rb @@ -12,19 +12,12 @@ mutation($input: NamespacesProjectsRuntimeAssignmentsUpdateModuleConfigurationsInput!) { namespacesProjectsRuntimeAssignmentsUpdateModuleConfigurations(input: $input) { #{error_query} - namespaceProjectRuntimeAssignment { + moduleConfigurations { id - compatible - runtime { id } - moduleConfigurations { - nodes { - id - value - definition { - id - identifier - } - } + value + definition { + id + identifier } } } @@ -81,15 +74,12 @@ mutate! - response_assignment = graphql_data_at( + response_configurations = graphql_data_at( :namespaces_projects_runtime_assignments_update_module_configurations, - :namespace_project_runtime_assignment + :module_configurations ) - expect(response_assignment['id']).to eq(runtime_assignment.to_global_id.to_s) - expect(response_assignment['compatible']).to be(true) - expect(response_assignment.dig('runtime', 'id')).to eq(runtime.to_global_id.to_s) - expect(response_assignment.dig('moduleConfigurations', 'nodes')).to contain_exactly( + expect(response_configurations).to contain_exactly( a_hash_including( 'value' => 'secret', 'definition' => a_hash_including( @@ -116,7 +106,7 @@ expect( graphql_data_at(:namespaces_projects_runtime_assignments_update_module_configurations, - :namespace_project_runtime_assignment) + :module_configurations) ).to be_nil expect( graphql_data_at(:namespaces_projects_runtime_assignments_update_module_configurations, :errors, :error_code) diff --git a/spec/services/namespaces/projects/runtime_assignments/update_module_configurations_service_spec.rb b/spec/services/namespaces/projects/runtime_assignments/update_module_configurations_service_spec.rb index d26698025..1196d0211 100644 --- a/spec/services/namespaces/projects/runtime_assignments/update_module_configurations_service_spec.rb +++ b/spec/services/namespaces/projects/runtime_assignments/update_module_configurations_service_spec.rb @@ -54,7 +54,7 @@ end it { is_expected.to be_success } - it { expect(service_response.payload).to eq(runtime_assignment) } + it { expect(service_response.payload).to match_array(runtime_assignment.module_configurations) } it { expect { service_response }.to change { ModuleConfiguration.count }.by(2) } it 'updates the runtime directly after persisting' do