diff --git a/client/pizza_palace.py b/client/pizza_palace.py index c1f644c5231adbe83dc863ea7fc4915d8761a1ff..bc1247f7d328b4354bb88a5d4b8fc9ca489fc173 100644 --- a/client/pizza_palace.py +++ b/client/pizza_palace.py @@ -20,17 +20,6 @@ mainframe.grid(column=0, row=0, sticky=(N, W, E, S)) root.columnconfigure(0, weight=1) root.rowconfigure(0, weight=1) - -name_label = ttk.Label(mainframe, text="Pizza Type: ") -name_label.grid(column=1, row=1, sticky=(W, E)) -name_entry = ttk.Entry(mainframe, width=10, textvariable=name) -name_entry.grid(column=2, row=1, sticky=(W, E)) - -age_label = ttk.Label(mainframe, text="Age: ") -age_label.grid(column=1, row=2, sticky=(W, E)) -age_entry = ttk.Entry(mainframe, width=10, textvariable=age) -age_entry.grid(column=2, row=2, sticky=(W, E)) - submit_button = ttk.Button(mainframe, text="Go!", command=submit) submit_button.grid(column=2, row=3, sticky=(W, E)) diff --git a/server/app.py b/server/app.py index 12f6d04ff89008c9ae3fe0ac9ffb6feb7675615d..12e0acd167faa222badbe586a2a14030e9522b35 100644 --- a/server/app.py +++ b/server/app.py @@ -1,6 +1,8 @@ -import json +import json, uuid, logging from flask import Flask, request, jsonify, Response +logger = logging.Logger(__name__) + app = Flask(__name__) import config @@ -12,15 +14,25 @@ open_carts = {} @app.route("/") def hello_world(): + # Return OK message return "{\"status\":200, \"message\": \"ok\"}", 200 @app.route("/pizzas", methods=["GET"]) def get_pizzas(): + # Return pizza types return jsonify(pizza_types), 200 @app.route("/cart/open", methods=["POST"]) def open_cart(): - return "{\"status\":404, \"message\": \"not implemented\"}", 404 + # Generate cart id and ensure it is unique + foundunique = False + while not foundunique: + cart_id = str(uuid.uuid4()) + if cart_id in open_carts: + logger.warn("Regenerating UUID for new cart - prev " + cart_id) + cart_key = str(uuid.uuid4()) + # TODO append cart to list and send to user + return "{\"status\":200, \"id\": \"not implemented\", \"key\": \"not implemented\"}", 200 if __name__ == "__main__": app.run() \ No newline at end of file