debian-mirror-gitlab/app/graphql/mutations/groups/update.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.1 KiB
Ruby
Raw Normal View History

2021-10-27 15:23:28 +05:30
# frozen_string_literal: true
module Mutations
module Groups
class Update < Mutations::BaseMutation
graphql_name 'GroupUpdate'
2022-04-04 11:22:00 +05:30
include Mutations::ResolvesGroup
2021-10-27 15:23:28 +05:30
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