diff options
Diffstat (limited to 'app/graphql/mutations/groups/update.rb')
-rw-r--r-- | app/graphql/mutations/groups/update.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/app/graphql/mutations/groups/update.rb b/app/graphql/mutations/groups/update.rb new file mode 100644 index 00000000000..9c5628a57cd --- /dev/null +++ b/app/graphql/mutations/groups/update.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module Mutations + module Groups + class Update < Mutations::BaseMutation + include Mutations::ResolvesGroup + + graphql_name 'GroupUpdate' + + authorize :admin_group + + field :group, Types::GroupType, + null: true, + description: 'Group after update.' + + argument :full_path, GraphQL::Types::ID, + required: true, + description: 'Full path of the group that will be updated.' + argument :shared_runners_setting, Types::Namespace::SharedRunnersSettingEnum, + required: true, + description: copy_field_description(Types::GroupType, :shared_runners_setting) + + def resolve(full_path:, **args) + group = authorized_find!(full_path: full_path) + + unless ::Groups::UpdateService.new(group, current_user, args).execute + return { group: nil, errors: group.errors.full_messages } + end + + { group: group, errors: [] } + end + + private + + def find_object(full_path:) + resolve_group(full_path: full_path) + end + end + end +end |