Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VILLASweb-backend-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ACS
Public
VILLASframework
VILLASweb-backend-node
Commits
eadb7cd1
Commit
eadb7cd1
authored
7 years ago
by
Markus Grigull
Browse files
Options
Downloads
Patches
Plain Diff
Remove unneeded simulator model and route
parent
176dba8f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
models/simulator.js
+0
-33
0 additions, 33 deletions
models/simulator.js
routes/simulators.js
+0
-118
0 additions, 118 deletions
routes/simulators.js
server.js
+0
-2
0 additions, 2 deletions
server.js
with
0 additions
and
153 deletions
models/simulator.js
deleted
100644 → 0
+
0
−
33
View file @
176dba8f
/**
* 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
);
This diff is collapsed.
Click to expand it.
routes/simulators.js
deleted
100644 → 0
+
0
−
118
View file @
176dba8f
/**
* 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
;
This diff is collapsed.
Click to expand it.
server.js
+
0
−
2
View file @
eadb7cd1
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment