19 lines
345 B
Ruby
19 lines
345 B
Ruby
class Api::V1::OrdersController < Api::V1::BaseController
|
|
include CollectionScope
|
|
|
|
before_action -> { doorkeeper_authorize! 'orders:read', 'orders:write' }
|
|
|
|
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
|