first commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
from flask import request, jsonify
|
||||
|
||||
import screens
|
||||
|
||||
from core.flask_app import app
|
||||
|
||||
|
||||
@app.route("/game/<slug>/screens/<int:screen_id>/flow/edges/add", methods=["POST"])
|
||||
def flow_edge_add(slug, screen_id):
|
||||
payload = request.get_json(force=True) or {}
|
||||
try:
|
||||
from_node_id = int(payload["from_node_id"])
|
||||
to_node_id = int(payload["to_node_id"])
|
||||
except (KeyError, TypeError, ValueError):
|
||||
return jsonify({"error": "nœuds invalides"}), 400
|
||||
edge_id = screens.add_flow_edge(slug, screen_id, from_node_id, payload.get("from_port", "out"), to_node_id)
|
||||
return jsonify({"id": edge_id})
|
||||
Reference in New Issue
Block a user