api routes defination

This commit is contained in:
Min Zeya Phyo
2017-04-08 16:39:33 +06:30
parent 0ddc7bdb44
commit a74e5f9590
3 changed files with 15 additions and 89 deletions

View File

@@ -1,24 +0,0 @@
class Api::Restaurant::InvoiceController < ActionController::API
before :authenticate_token
#Description
# This API show current order details
# Input Params - order_id
def show
order = Order.find(params[:order_id])
order.order_items
end
# Description
# This API allow new invoice creation
# Input Params
# order_id
# Output Params
# Status [Success | Error | System Error] , order_id, error_message (*)
def create
end
end

View File

@@ -1,63 +0,0 @@
class Api::Restaurant::OrdersController < ActionController::API
#before :authenticate_token
#Description
# This API show current order details
# Input Params - order_id
def show
order = Order.find(params[:order_id])
order.order_items
end
# Description
# This API allow new order creation
# Input Params
# order_source [* default - emenu] | table_id | booking_id [table_booking_id & Room_booking_id] (*require for Dine-In) | order_type [* Default - Dine-in]
# | guest_info (optional) | customer_id (* Default assigned to WALK-IN)
# order_items {[item_code, item_instance_code , qty, option, variants]}
# Output Params
# Status [Success | Error | System Error] , order_id, error_message (*)
def create
# begin
@order = Order.new
@order.source = params[:order_source]
@order.order_type = params[:order_type]
@order.customer_id = params[:customer_id]
json_hash = params[:order_items]
@order.items = json_hash
@order.guest = params[:guest_info]
@order.table_id = params[:table_id]
@order.new_booking = true
@order.employee_name = "Test User"
#Create Table Booking or Room Booking
if !params["booking_id"].nil?
@order.new_booking = false
@order.booking_id = params[:booking_id]
end
@status = @order.generate
# rescue Exception => error
# @status = false
# @error_messages = "Exception has occurs on System"
#
# logger.fatal("Exception Raise - " + error.message)
# end
end
# Description
# This API - allow order to add new items to existing orders, does not allow you to remove confirm items
# Update customer info, Guest Info
# Input Params
# order_id , order_items {[item_code, item_instance_code , qty, option, variants]}
def update
end
end

View File

@@ -19,10 +19,23 @@ Rails.application.routes.draw do
namespace :restaurant do namespace :restaurant do
get 'zones' => "zones#index" get 'zones' => "zones#index"
get 'tables' => "#index" get 'tables' => "#index"
#Order Controller #Menu Related api
resources :orders, only: [:create, :show, :update] resources :menu, only: [:index, :show] do
resources :menu_categories, only: [:index]
resources :menu_items, only: [:index, :show]
resources :menu_sold_out, only: [:index]
end
end end
#Order Controller
resources :orders, only: [:create, :show, :update]
#Current active bookings
resources :bookings, only: [:index, :create, :update]
resources :customers, only: [:index, :show, :create] resources :customers, only: [:index, :show, :create]
#Generating Invoice and making payments
resources :invoices, only: [:create, :show, :update :show ] do
resources :payments, only: [:create]
end
end end
#--------- Cashier ------------# #--------- Cashier ------------#