Sha256: e846aef9666ac6d6f2cbfa59faef0f892c536f75a24443b54656eed9750c6b6e

Contents?: true

Size: 745 Bytes

Versions: 7

Compression:

Stored size: 745 Bytes

Contents

# frozen_string_literal: true

module Ibrain::Mutations
  class GenerateFirebaseTokenMutation < AuthMutation
    field :result, Boolean, null: true
    field :token, String, null: true

    argument :attributes, ::Ibrain::Types::Input::GenerateFirebaseTokenInput, required: true

    def resolve(_args)
      token = repo.generate_custom_token!

      graphql_returning(token)
    end

    private

    def normalize_parameters
      attribute_params.permit(:uid)
    rescue StandardError
      ActionController::Parameters.new({})
    end

    def repo
      ::FirebaseRepository.new(nil, normalize_parameters)
    end

    def graphql_returning(token)
      OpenStruct.new(
        token: token,
        result: true
      )
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ibrain-auth-0.3.14 app/graphql/ibrain/mutations/generate_firebase_token_mutation.rb
ibrain-auth-0.3.13 app/graphql/ibrain/mutations/generate_firebase_token_mutation.rb
ibrain-auth-0.3.12 app/graphql/ibrain/mutations/generate_firebase_token_mutation.rb
ibrain-auth-0.3.11 app/graphql/ibrain/mutations/generate_firebase_token_mutation.rb
ibrain-auth-0.3.10 app/graphql/ibrain/mutations/generate_firebase_token_mutation.rb
ibrain-auth-0.3.9 app/graphql/ibrain/mutations/generate_firebase_token_mutation.rb
ibrain-auth-0.3.8 app/graphql/ibrain/mutations/generate_firebase_token_mutation.rb