Sha256: 3ec9aa0ae7d239a178d0f774b7728fb1f273711d8a6c41174a9fa491a2263be6

Contents?: true

Size: 1.41 KB

Versions: 37

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

module Platform
  module Mutations
    IncrementThing = GraphQL::Relay::Mutation.define do
      name "IncrementThing"
      description "increments the thing by 1."
      visibility :internal
      minimum_accepted_scopes ["repo"]

      input_field(:thingId,
        !types.ID,
        "Thing ID to log.",
        option: :setting)

      return_field(
        :thingId,
        !types.ID,
        "Thing ID to log."
      )

      resolve ->(root_obj, inputs, context) do
        if some_early_check
          return { thingId: "000" }
        end

        # These shouldn't be modified:
        { abcDef: 1 }
        some_method do { xyzAbc: 1 } end

        thing = Platform::Helpers::NodeIdentification.typed_object_from_id(Objects::Thing, inputs[:thingId], context)
        raise Errors::Validation.new("Thing not found.") unless thing

        ThingActivity.track(thing.id, Time.now.change(min: 0, sec: 0))


        if random_condition
          { thingId: thing.global_relay_id }
        elsif other_random_thing
          { :thingId => "abc" }
        elsif something_else
          method_with_block {
            { thingId: "pqr" }
          }
        elsif yet_another_thing
          begin
            { thingId: "987" }
          rescue
            { thingId: "789" }
          end
        else
          return {
            thingId: "xyz"
          }
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
graphql-1.8.18 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.11 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.10 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.9 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.8 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.7 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.6 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.5 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.4 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.3 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.2 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.8.17 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.8.16 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.1 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.0 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.8.15 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.0.pre4 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.8.14 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.0.pre3 spec/fixtures/upgrader/increment_count.original.rb
graphql-1.9.0.pre2 spec/fixtures/upgrader/increment_count.original.rb