2018-10-13 16:16:44 +02:00
|
|
|
class Api::V1::OrdersController < Api::V1::BaseController
|
2022-10-18 17:23:18 +02:00
|
|
|
include CollectionScope
|
2018-10-13 16:16:44 +02:00
|
|
|
|
2021-03-01 15:27:26 +01:00
|
|
|
before_action -> { doorkeeper_authorize! 'orders:read', 'orders:write' }
|
2018-10-13 16:16:44 +02:00
|
|
|
|
|
|
|
def index
|
|
|
|
render_collection search_scope
|
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
render json: scope.find(params.require(:id))
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def scope
|
|
|
|
Order.includes(:supplier)
|
|
|
|
end
|
|
|
|
end
|