60 lines
2.0 KiB
JavaScript
60 lines
2.0 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 } |