Sha256: e8f4a3522bbd9ebde8703421750651efb5961bbea6edafe16856adb593545b4d

Contents?: true

Size: 675 Bytes

Versions: 2

Compression:

Stored size: 675 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',
          resource: user
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphql_devise-2.0.0 spec/dummy/app/graphql/mutations/register_confirmed_user.rb
graphql_devise-1.4.0 spec/dummy/app/graphql/mutations/register_confirmed_user.rb