Kinda fix networks
This commit is contained in:
@@ -16,7 +16,7 @@ class Blueprint(ApiBlueprint):
|
||||
def show():
|
||||
return self.module.name
|
||||
|
||||
@self.blueprint.route('/networks')
|
||||
@self.blueprint.route('/networks', methods=["GET", "POST"])
|
||||
def networks():
|
||||
if request.method == "GET":
|
||||
networks = []
|
||||
@@ -27,11 +27,13 @@ class Blueprint(ApiBlueprint):
|
||||
|
||||
elif request.method == "POST":
|
||||
content:dict = request.json
|
||||
user_id = content["user_id"]
|
||||
network_id = content["network_id"]
|
||||
self.module.user_add_network(user_id, network_id)
|
||||
name = content["name"]
|
||||
description = content["description"]
|
||||
type = content["type"]
|
||||
modules = content["modules"]
|
||||
network = self.module.create_network(name, description, type, modules)
|
||||
|
||||
return jsonify({"network_id":network_id})
|
||||
return jsonify({"network_id":network.get("id")})
|
||||
|
||||
@self.blueprint.route("/networks/<path:network_id>", methods=["GET", "PUT", "DELETE"])
|
||||
def network(network_id):
|
||||
@@ -48,4 +50,31 @@ class Blueprint(ApiBlueprint):
|
||||
user_id = content["user_id"]
|
||||
self.module.user_remove_network(user_id, network_id)
|
||||
return jsonify({"networkId":network_id})
|
||||
|
||||
@self.blueprint.route("/networks/<path:network_id>/rendezvous", methods=["GET", "POST", "DELETE"])
|
||||
def network_rendezvous(network_id):
|
||||
if request.method == "GET":
|
||||
network_rendezvous = self.module.nosys_core.data.get_network(network_id)["rendezvous"]
|
||||
return jsonify(network_rendezvous)
|
||||
|
||||
elif request.method == "POST":
|
||||
content:dict = request.json
|
||||
rendezvous_id = content["rendezvous_id"]
|
||||
self.module.nosys_core.data.network_assign_rendezvous(network_id, rendezvous_id)
|
||||
return jsonify()
|
||||
|
||||
# Rendezvous
|
||||
|
||||
@self.blueprint.route('/rendezvous', methods=["GET", "POST"])
|
||||
def rendezvous():
|
||||
if request.method == "GET":
|
||||
return jsonify(self.module.nosys_core.data.list_rendezvous())
|
||||
|
||||
elif request.method == "POST":
|
||||
content:dict = request.json
|
||||
id = content["id"]
|
||||
address = content["address"]
|
||||
self.module.nosys_core.data.add_rendezvous(id, address)
|
||||
|
||||
return jsonify()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user