Save Markdowns

This commit is contained in:
h z
2024-12-06 15:13:20 +00:00
parent 48dd59f8e4
commit b3ec244e06
9 changed files with 100 additions and 34 deletions

View File

@@ -40,7 +40,7 @@ def create_path():
if not data or 'name' not in data or 'parent_id' not in data:
return jsonify({"error": "bad request"}), 400
with get_db() as session:
if data['parent_id'] != 0 and not session.query(Path).get(data['parent_id']):
if data['parent_id'] != 1 and not session.query(Path).get(data['parent_id']):
return jsonify({"error": "path not found"}), 404
if session.query(Path).filter_by(name=data['name'], parent_id=data['parent_id']).first():
return jsonify({"error": "Path already exists under the parent"}), 409