Sha256: 33fef8594097661646697a945543b189eacd8aff922819d0060fae530d9c985a

Contents?: true

Size: 800 Bytes

Versions: 3

Compression:

Stored size: 800 Bytes

Contents

# frozen_string_literal: true

module Osso
  module GraphQL
    module Mutations
      class CreateEnterpriseAccount < BaseMutation
        null false

        argument :domain, String, required: true
        argument :name, String, required: true

        field :enterprise_account, Types::EnterpriseAccount, null: false
        field :errors, [String], null: false

        def resolve(**args)
          enterprise_account = Osso::Models::EnterpriseAccount.new(args)

          if enterprise_account.save
            Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: args)
            return response_data(enterprise_account: enterprise_account)
          end

          response_error(enterprise_account.errors)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
osso-0.1.2 lib/osso/graphql/mutations/create_enterprise_account.rb
osso-0.1.1 lib/osso/graphql/mutations/create_enterprise_account.rb
osso-0.1.0 lib/osso/graphql/mutations/create_enterprise_account.rb