diff --git a/docker/ploughshares/app.py b/docker/ploughshares/app.py index 884592c..1feb668 100644 --- a/docker/ploughshares/app.py +++ b/docker/ploughshares/app.py @@ -1068,12 +1068,6 @@ def create_source(): """API endpoint to create a source""" data = request.form.to_dict() - # Validate required fields - required_fields = ['title', 'link', 'type'] - for field in required_fields: - if field not in data or not data[field]: - return jsonify({"error": f"Missing required field: {field}"}), 400 - conn = get_db_connection() if conn is None: return jsonify({"error": "Database connection error"}), 500 @@ -1089,9 +1083,9 @@ def create_source(): ) RETURNING src_id """, { - 'title': data['title'], - 'link': data['link'], - 'type': data['type'] + 'title': data['title'] if ('title' in data) else "", + 'link': data['link'] if ('link' in data) else "", + 'type': data['type'] if ('link' in data) else "" } ) result = cur.fetchone()