API v1 orders endpoints
This commit is contained in:
parent
7d5155bef6
commit
127ae83f04
9 changed files with 165 additions and 10 deletions
19
app/controllers/api/v1/orders_controller.rb
Normal file
19
app/controllers/api/v1/orders_controller.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
class Api::V1::OrdersController < Api::V1::BaseController
|
||||
include Concerns::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
|
||||
Loading…
Add table
Add a link
Reference in a new issue