def get_dishes(restaurant_id): restaurant = RestaurantService.get_restaurant(restaurant_id) if restaurant is None: return error_message("404", "Restaurant not found"), 404 dishes = RestaurantService.get_dishes(restaurant_id) return list_obj_json("dishes", dishes)
def get_restaurant_more_info(restaurant_id): # get restaurant and check if restaurant exists restaurant = RestaurantService.get_restaurant(restaurant_id) if restaurant is None: return error_message("404", "Restaurant not found"), 404 info = dict() info["Restaurant"] = serialize(restaurant) # get menus menus = RestaurantService.get_menus(restaurant_id) all_menus = [] # get menu photos for each menu for menu in menus: photos = RestaurantService.get_menu_photos(menu.id) json_menu = serialize(menu) photos_list = [] for photo in photos: photos_list.append(serialize(photo)) json_menu["photos"] = photos_list all_menus.append(json_menu) info["Menus"] = all_menus # get photos about restaurant photos = RestaurantService.get_photos(restaurant_id) info["Photos"] = list_obj_json("", photos) # get dishes dishes = RestaurantService.get_dishes(restaurant_id) info["Dishes"] = list_obj_json("", dishes) # get openings openings = RestaurantService.get_openings(restaurant_id) info["Openings"] = list_obj_json("", openings) return json.loads(json.dumps({"Restaurant_info": info}))