Sha256: 4ff276bf570642d46f1399c3161c8b0c62381342ef373ead56ef662358f50bd1
Contents?: true
Size: 1 KB
Versions: 4
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true module SolidusGraphqlApi module Mutations module Checkout class UpdateCartQuantity < BaseMutation null true argument :line_item_id, ID, required: true, loads: Types::LineItem argument :quantity, Integer, required: true field :order, Types::Order, null: true field :errors, [Types::UserError], null: false def resolve(line_item:, quantity:) update_params = { line_items_attributes: { id: line_item.id, quantity: quantity } } current_order.contents.update_cart(update_params) { order: current_order, errors: user_errors("line_item", line_item.errors) } end def authorized?(line_item:, **) current_order.line_items.find(line_item.id) end def ready?(*) current_ability.authorize!(:update, current_order, guest_token) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems