Sha256: 89eb9b95525b08bdb717552681ba23386bf788b4f3d1541fe238c4343907158e

Contents?: true

Size: 832 Bytes

Versions: 16

Compression:

Stored size: 832 Bytes

Contents

module Workarea
  module Api
    module Storefront
      class OrdersController < Api::Storefront::ApplicationController
        def index
          models = Order.recent(
            current_user.id,
            Workarea.config.storefront_user_order_display_count
          )
          statuses = Fulfillment.find_statuses(*models.map(&:id))

          @orders = models.map do |order|
            Workarea::Storefront::OrderViewModel.new(
              order,
              fulfillment_status: statuses[order.id]
            )
          end
        end

        def show
          model = Order.find(params[:id])

          if model.user_id != current_user.id.to_s
            head :forbidden
          else
            @order = Workarea::Storefront::OrderViewModel.new(model)
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
workarea-api-4.5.6 storefront/app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-storefront-4.5.6 app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-4.5.5 storefront/app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-storefront-4.5.5 app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-4.5.4 storefront/app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-storefront-4.5.4 app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-4.5.3 storefront/app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-storefront-4.5.3 app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-4.5.2 storefront/app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-storefront-4.5.2 app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-4.5.0 storefront/app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-storefront-4.5.0 app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-4.4.7 storefront/app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-storefront-4.4.7 app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-4.4.6 storefront/app/controllers/workarea/api/storefront/orders_controller.rb
workarea-api-storefront-4.4.6 app/controllers/workarea/api/storefront/orders_controller.rb