From 45b73e4683cce35de79117c5b4a6919556d9644f Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Fri, 2 Jul 2021 14:26:23 +0200 Subject: api: Add stricter validation of input/output data This change adds stricter validation of data that enters and leaves the database. As a result, we clearly separate the database model from the data model that the REST API exports. --- opendc-web/opendc-web-ui/src/api/topologies.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'opendc-web/opendc-web-ui') diff --git a/opendc-web/opendc-web-ui/src/api/topologies.js b/opendc-web/opendc-web-ui/src/api/topologies.js index c8744e6c..802be4bb 100644 --- a/opendc-web/opendc-web-ui/src/api/topologies.js +++ b/opendc-web/opendc-web-ui/src/api/topologies.js @@ -31,7 +31,8 @@ export function getTopology(auth, topologyId) { } export function updateTopology(auth, topology) { - return request(auth, `topologies/${topology._id}`, 'PUT', { topology }) + const { _id, ...data } = topology; + return request(auth, `topologies/${topology._id}`, 'PUT', { topology: data }) } export function deleteTopology(auth, topologyId) { -- cgit v1.2.3