2021-08-05 17:10:12 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module Groups
|
|
|
|
class Update < Mutations::BaseMutation
|
|
|
|
graphql_name 'GroupUpdate'
|
|
|
|
|
2022-02-15 07:14:49 -05:00
|
|
|
include Mutations::ResolvesGroup
|
|
|
|
|
2021-08-05 17:10:12 -04:00
|
|
|
authorize :admin_group
|
|
|
|
|
|
|
|
field :group, Types::GroupType,
|
|
|
|
null: true,
|
2021-08-11 23:10:11 -04:00
|
|
|
description: 'Group after update.'
|
2021-08-05 17:10:12 -04:00
|
|
|
|
|
|
|
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
|