Sha256: 5d1cc0502de3e795888230e7ef3499c010aa30cec73889676d8ab2b8c1c1f773

Contents?: true

Size: 694 Bytes

Versions: 24

Compression:

Stored size: 694 Bytes

Contents

# frozen_string_literal: true

module Mutations
  class RegisterConfirmedUser < GraphqlDevise::Mutations::Base
    argument :email,                 String, required: true
    argument :name,                  String, required: true
    argument :password,              String, required: true
    argument :password_confirmation, String, required: true

    field :user, Types::UserType, null: true

    def resolve(**attrs)
      user = User.new(attrs.merge(confirmed_at: Time.zone.now))

      if user.save
        { user: user }
      else
        raise_user_error_list(
          'Custom registration failed',
          errors: user.errors.full_messages
        )
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
graphql_devise-0.13.3 spec/dummy/app/graphql/mutations/register_confirmed_user.rb
graphql_devise-0.13.2 spec/dummy/app/graphql/mutations/register_confirmed_user.rb
graphql_devise-0.13.1 spec/dummy/app/graphql/mutations/register_confirmed_user.rb
graphql_devise-0.13.0 spec/dummy/app/graphql/mutations/register_confirmed_user.rb