API login/logout with http header token
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
class DiningFacility < ApplicationRecord
|
||||
belongs_to :zone
|
||||
|
||||
default_scope { order('order_by asc') }
|
||||
|
||||
scope :active, -> {where(is_active: true)}
|
||||
|
||||
def get_current_booking
|
||||
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='occupied' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)
|
||||
|
||||
if booking.count > 0 then
|
||||
return booking[0]
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,9 +2,11 @@ class MenuCategory < ApplicationRecord
|
||||
belongs_to :menu
|
||||
has_many :children, :class_name => "MenuCategory", foreign_key: "menu_category_id"
|
||||
belongs_to :parent, :class_name => "MenuCategory", foreign_key: "menu_category_id", optional: true
|
||||
|
||||
has_many :menu_items
|
||||
|
||||
validates_presence_of :name
|
||||
|
||||
default_scope { order('order_by asc') }
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
class MenuItem < ApplicationRecord
|
||||
belongs_to :menu_category
|
||||
has_many :menu_item_instances
|
||||
belongs_to :parent, :class_name => "MenuItem", foreign_key: "menu_item_id"
|
||||
belongs_to :parent, :class_name => "MenuItem", foreign_key: "menu_item_id", :optional => true
|
||||
has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id"
|
||||
|
||||
default_scope { order('item_code asc') }
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user