DSatishchandra commited on
Commit
d660836
·
verified ·
1 Parent(s): 216610c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -151,18 +151,18 @@ def submit():
151
 
152
  @app.route("/menu", methods=["GET"])
153
  def menu_page():
154
- # Query the Salesforce Menu_Item__c object to get the menu items
155
  try:
156
- menu_items = get_menu_items(sf) # Fetch menu items from Salesforce
157
- menu_data = [{"name": item['Name'], "price": item['Price__c'],
158
- "ingredients": item['Ingredients__c'], "category": item['Category__c']}
159
- for item in menu_items]
160
-
161
- return jsonify(menu_data) # Return the menu items as JSON
162
-
163
  except Exception as e:
164
  return jsonify({"error": f"Failed to fetch menu items from Salesforce: {str(e)}"}), 500
165
 
 
166
  @app.route("/order", methods=["POST"])
167
  def place_order():
168
  order_data = request.json
 
151
 
152
  @app.route("/menu", methods=["GET"])
153
  def menu_page():
 
154
  try:
155
+ # Query Salesforce for the menu items
156
+ query = "SELECT Name, Price__c, Ingredients__c, Category__c FROM Menu_Item__c"
157
+ result = sf.query(query)
158
+
159
+ # Pass the menu items to the template
160
+ return render_template("menu_page.html", menu_items=result['records'])
161
+
162
  except Exception as e:
163
  return jsonify({"error": f"Failed to fetch menu items from Salesforce: {str(e)}"}), 500
164
 
165
+
166
  @app.route("/order", methods=["POST"])
167
  def place_order():
168
  order_data = request.json