diff --git a/Backend/__pycache__/db_access.cpython-39.pyc b/Backend/__pycache__/db_access.cpython-39.pyc index fc82682..8ffbaec 100644 Binary files a/Backend/__pycache__/db_access.cpython-39.pyc and b/Backend/__pycache__/db_access.cpython-39.pyc differ diff --git a/Backend/backend.py b/Backend/backend.py index d378fb9..29a0f9d 100644 --- a/Backend/backend.py +++ b/Backend/backend.py @@ -23,8 +23,8 @@ -@app.route("/submit", methods=["POST"]) -def submit(): +@app.route("/store_image", methods=["POST"]) +def store_image(): data = request.get_json() # Validate required fields @@ -101,21 +101,20 @@ def login(): return jsonify({"message": str(e)}), 500 - -@app.route("/register", methods=["POST"]) +@app.route("/create_user", methods=["POST"]) def register(): print("received register request") print(request, request.data) - return jsonify({"message": "No endpoint called register, perhaps you meant: /create_user"}) + return jsonify({"message": "No endpoint called create_user, perhaps you meant: /register"}) -@app.route("/create_user", methods=["POST"]) -def create_user(): +@app.route("/register", methods=["POST"]) +def register(): #print("BACKEND") data = request.get_json() # Validate required fields - required_fields = ["username", "password", "name", "email"] + required_fields = ["username", "password", "email"] missing_fields = [field for field in required_fields if field not in data] if missing_fields: @@ -127,7 +126,6 @@ def create_user(): username = data["username"] plain_text_password = data["password"] - name = data["name"] email = data["email"] # Hash the password @@ -137,8 +135,7 @@ def create_user(): user_data = { "username": username, "email": email, - "password": hashed_password, - "name": name + "password": hashed_password } # Send the user data with the hashed password to the database access layer diff --git a/Backend/db_access.py b/Backend/db_access.py index bf25b41..84709ed 100644 --- a/Backend/db_access.py +++ b/Backend/db_access.py @@ -25,7 +25,7 @@ class User(Document): encrypted_password = StringField( required=True ) - name = StringField(required=True) + ranking = IntField() @@ -48,7 +48,6 @@ def create_user(): user = User( username=data["username"], encrypted_password=data["password"], - name=data["name"], email=data["email"] ) try: