summaryrefslogtreecommitdiff
path: root/web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py
diff options
context:
space:
mode:
Diffstat (limited to 'web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py')
-rw-r--r--web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py b/web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py
index 952959ca..ecf80353 100644
--- a/web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py
+++ b/web-server/opendc/api/v2/simulations/simulationId/topologies/endpoint.py
@@ -9,7 +9,12 @@ from opendc.util.database import Database
def POST(request):
"""Add a new Topology to the specified simulation and return it"""
- request.check_required_parameters(path={'simulationId': 'string'}, body={'topology': {'name': 'string'}})
+ request.check_required_parameters(path={'simulationId': 'string'},
+ body={
+ 'topology': {
+ 'name': 'string'
+ }
+ })
simulation = Simulation.from_id(request.params_path['simulationId'])
@@ -17,6 +22,7 @@ def POST(request):
simulation.check_user_access(request.google_id, True)
topology = Topology({'name': request.params_body['topology']['name']})
+
topology.set_property('datetimeCreated', Database.datetime_to_string(datetime.now()))
topology.set_property('datetimeLastEdited', Database.datetime_to_string(datetime.now()))
topology.insert()