diff --git a/delivery1/server/requirements.txt b/delivery1/server/requirements.txt index 3139099..b65df60 100644 --- a/delivery1/server/requirements.txt +++ b/delivery1/server/requirements.txt @@ -1,3 +1,4 @@ +cryptography flask flask_sqlalchemy pytest \ No newline at end of file diff --git a/delivery1/server/routes/file.py b/delivery1/server/routes/file.py index b3ab3bc..8c70a5b 100644 --- a/delivery1/server/routes/file.py +++ b/delivery1/server/routes/file.py @@ -1,3 +1,5 @@ +import json + from flask import Blueprint, request, jsonify, send_file, Response import utils @@ -44,6 +46,8 @@ def file_upload_metadata(): return session data = request.json + if type(data) is str: + data = json.loads(data) if "document_name" not in data or "key" not in data or "alg" not in data: return jsonify({"error": "Missing required fields"}), 400 @@ -98,6 +102,8 @@ def file_list(): data = request.json + if type(data) is str: + data = json.loads(data) org = OrganizationService.get_organization(session.org_id) if not org: diff --git a/delivery1/server/routes/org.py b/delivery1/server/routes/org.py index 88e4ba0..586952b 100644 --- a/delivery1/server/routes/org.py +++ b/delivery1/server/routes/org.py @@ -1,3 +1,4 @@ +import json from flask import Blueprint, request, jsonify from services import OrganizationService @@ -6,6 +7,8 @@ org_bp = Blueprint("org", __name__) @org_bp.route("/create", methods=["POST"]) def org_create(): data = request.json + if type(data) is str: + data = json.loads(data) if "name" not in data or "username" not in data or "full_name" not in data or "email" not in data or "public_key" not in data: return jsonify({"error": "Missing required fields"}), 400 diff --git a/delivery1/server/routes/user.py b/delivery1/server/routes/user.py index 7ac7a13..4efea2b 100644 --- a/delivery1/server/routes/user.py +++ b/delivery1/server/routes/user.py @@ -8,6 +8,8 @@ user_bp = Blueprint("user", __name__) @user_bp.route("/login", methods=["POST"]) def user_login(): data = request.json + if type(data) is str: + data = json.loads(data) if "username" not in data or "org" not in data: return jsonify({"error": "Missing required fields"}), 400 @@ -49,6 +51,8 @@ def user_list(): return session data = request.json + if type(data) is str: + data = json.loads(data) org = OrganizationService.get_organization(session.org_id) if not org: @@ -75,6 +79,9 @@ def user_create(): return session data = request.json + if type(data) is str: + data = json.loads(data) + if "username" not in data or "full_name" not in data or "email" not in data or "public_key" not in data: return jsonify({"error": "Missing required fields"}), 400