60 lines
1.5 KiB
JavaScript
60 lines
1.5 KiB
JavaScript
import express from 'express';
|
|
|
|
/**
|
|
* ScenariosController. API for the scenarios manager
|
|
*/
|
|
class ScenariosController{
|
|
|
|
name = 'scenariosApi'
|
|
route = '/api/scenario'
|
|
|
|
/**
|
|
* Initializes the ScenariosController plugin
|
|
* @param {App} app The application instance
|
|
*/
|
|
init(app){
|
|
const router = express.Router();
|
|
const { scenarios } = app;
|
|
|
|
/**
|
|
* API: PUT /api/scenario/ Create or update scenario
|
|
* @function createOrUpdate
|
|
* @memberof ScenariosController
|
|
*/
|
|
router.put('/', async (req, res)=>{
|
|
|
|
});
|
|
|
|
/**
|
|
* API: POST /api/scenario/ List scenarios by given criteria
|
|
* @function list
|
|
* @returns {Scenario[]}
|
|
* @memberof ScenariosController
|
|
*/
|
|
router.post('/', async (req, res)=>{
|
|
})
|
|
|
|
/**
|
|
* API: GET /api/scenario/:id Retrieve scenario by ID
|
|
* @function read
|
|
* @param {string} id The id of the scenario
|
|
* @returns {Scenario}
|
|
* @memberof ScenariosController
|
|
*/
|
|
router.get('/:id', async (req, res)=>{
|
|
})
|
|
|
|
/**
|
|
* API: DELETE /api/scenario/:id Delete scenario by ID
|
|
* @function remove
|
|
* @param {string} id The id of the scenario
|
|
* @memberof ScenariosController
|
|
*/
|
|
router.delete('/:id', async (req, res)=>{
|
|
})
|
|
|
|
app.webServer.xapp.use(this.route, router);
|
|
}
|
|
}
|
|
|
|
export { ScenariosController } |