summaryrefslogtreecommitdiff
path: root/app/graphql/resolvers/echo_resolver.rb
blob: a09b0a1fd878892b16e3ee2fa78b86a1f7a889f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

module Resolvers
  class EchoResolver < BaseResolver
    type ::GraphQL::STRING_TYPE, null: false
    description 'Testing endpoint to validate the API with'

    argument :text,
             type: GraphQL::STRING_TYPE,
             required: true,
             description: 'Text to echo back.'

    def resolve(text:)
      username = current_user&.username

      "#{username.inspect} says: #{text}"
    end
  end
end