diff --git a/models/simulator.js b/models/simulator.js deleted file mode 100644 index 1d561f4a18613ca44d2d7f92988218fd2ed3f4ba..0000000000000000000000000000000000000000 --- a/models/simulator.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * File: simulation.js - * Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de> - * Date: 28.09.2016 - * - * This file is part of VILLASweb-backend. - * - * VILLASweb-backend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * VILLASweb-backend is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with VILLASweb-backend. If not, see <http://www.gnu.org/licenses/>. - ******************************************************************************/ - - // include - var mongoose = require('mongoose'); - - var Schema = mongoose.Schema; - - // simulator model - var simulatorSchema = new Schema({ - name: { type: String, required: true }, - config: { type: Schema.Types.Mixed, default: {} } - }); - - module.exports = mongoose.model('Simulator', simulatorSchema); diff --git a/routes/simulators.js b/routes/simulators.js deleted file mode 100644 index bee398457f37664837af08d89a1ee93d5ddd1d89..0000000000000000000000000000000000000000 --- a/routes/simulators.js +++ /dev/null @@ -1,118 +0,0 @@ -/** - * File: simulators.js - * Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de> - * Date: 28.09.2016 - * - * This file is part of VILLASweb-backend. - * - * VILLASweb-backend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * VILLASweb-backend is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with VILLASweb-backend. If not, see <http://www.gnu.org/licenses/>. - ******************************************************************************/ - -// include -var express = require('express'); - -//var auth = require('../auth'); -var logger = require('../utils/logger'); - -// models -var Simulator = require('../models/simulator'); - -// create router -var router = express.Router(); - -// all model routes need authentication -//router.use('/simulators', auth.validateToken); - -// routes -router.get('/simulators', /*auth.validateRole('simulator', 'read'),*/ function(req, res) { - // get all simulators - Simulator.find(function(err, simulators) { - if (err) { - logger.error('Unable to receive simulators', err); - return res.status(400).send(err); - } - - res.send({ simulators: simulators }); - }); -}); - -router.post('/simulators', /*auth.validateRole('simulator', 'create'),*/ function(req, res) { - // create new simulator - var simulator = new Simulator(req.body.simulator); - - simulator.save(function(err) { - if (err) { - logger.error('Unable to create simulator', err); - return res.status(400).send(err); - } - - res.send({ simulator: simulator }); - }); -}); - -router.put('/simulators/:id', /*auth.validateRole('simulator', 'update'),*/ function(req, res) { - // get simulator - Simulator.findOne({ _id: req.params.id }, function(err, simulator) { - if (err) { - logger.log('verbose', 'PUT Unknown simulator for id: ' + req.params.id); - return res.status(400).send(err); - } - - // update all properties - for (property in req.body.simulator) { - simulator[property] = req.body.simulator[property]; - } - - // save the changes - simulator.save(function(err) { - if (err) { - logger.error('Unable to save simulator', simulator); - return res.status(500).send(err); - } - - res.send({ simulator: simulator }); - }); - }); -}); - -router.get('/simulators/:id', /*auth.validateRole('simulator', 'read'),*/ function(req, res) { - Simulator.findOne({ _id: req.params.id }, function(err, simulator) { - if (err) { - logger.log('verbose', 'GET Unknown simulator for id: ' + req.params.id); - return res.status(400).send(err); - } - - res.send({ simulator: simulator }); - }); -}); - -router.delete('/simulators/:id', /*auth.validateRole('simulator', 'delete'),*/ function(req, res) { - Simulator.findOne({ _id: req.params.id }, function(err, simulator) { - if (err) { - logger.log('verbose', 'DELETE Unknown simulator for id: ' + req.params.id); - return res.status(400).send(err); - } - - simulator.remove(function(err) { - if (err) { - logger.error('Unable to remove simulator', simulator); - return res.status(500).send(err); - } - - res.send({}); - }); - }); -}); - -module.exports = router; diff --git a/server.js b/server.js index 830f3eed8d4e57c9f78cc9e7ee6b7dc8691b0a2b..0fcc5cd883088ba2a291f80d2eaf03f11cf5f657 100644 --- a/server.js +++ b/server.js @@ -34,7 +34,6 @@ var projects = require('./routes/projects'); var visualizations = require('./routes/visualizations'); var widgets = require('./routes/widgets'); var simulations = require('./routes/simulations'); -var simulators = require('./routes/simulators'); var upload = require('./routes/upload'); var files = require('./routes/files'); var nodes = require('./routes/nodes'); @@ -89,7 +88,6 @@ app.use('/api/v1', projects); app.use('/api/v1', visualizations); app.use('/api/v1', widgets); app.use('/api/v1', simulations); -app.use('/api/v1', simulators); app.use('/api/v1', upload); app.use('/api/v1', files); app.use('/api/v1', nodes);