Class: Api::Dashboard::RestaurantsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/api/dashboard/restaurants_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#current_user, #identity_cache_memoization, #restaurants, #set_options

Methods included from LogrageCustomLogger

#append_info_to_payload

Methods included from ControllerHelpers

#check_boolean_param, #get_banners, #inventory_params, #reservation_params

Methods included from ResponseCacheConcern

#my_response_cache

Instance Method Details

#indexObject



4
5
6
7
8
# File 'app/controllers/api/dashboard/restaurants_controller.rb', line 4

def index
   my_response_cache([current_staff.restaurants.cache_key, ::Api::Dashboard::RestaurantSerializer.mtime], :json) do
    ::Api::Dashboard::RestaurantSerializer.new(current_staff.restaurants)
   end
end

#showObject



10
11
12
13
14
15
16
17
# File 'app/controllers/api/dashboard/restaurants_controller.rb', line 10

def show
  restaurant = Restaurant.fetch params.require(:id)
  my_response_cache([restaurant.cache_key, current_staff.cache_key, ::Api::Dashboard::RestaurantSerializer.mtime], :json) do
    raise NotAuthorized unless current_staff.restaurants.include? restaurant

   ::Api::Dashboard::RestaurantSerializer.new(restaurant)
  end
end