lists
This commit is contained in:
@@ -14,7 +14,7 @@ class ScenariosController{
|
||||
*/
|
||||
init(app){
|
||||
const router = express.Router();
|
||||
const { scenarios } = app;
|
||||
const { scenario } = app;
|
||||
|
||||
/**
|
||||
* API: PUT /api/scenario/ Create or update scenario, създаване/обновяване на игрови сценарий
|
||||
@@ -24,7 +24,7 @@ class ScenariosController{
|
||||
router.put('/', async (req, res)=>{
|
||||
try{
|
||||
let data = req.body;
|
||||
let object = await scenarios[data.id? 'update' : 'create'](req, data)
|
||||
let object = await scenario[data.id? 'update' : 'create'](req, data)
|
||||
res.json({status: 'OK', object});
|
||||
}catch(err){
|
||||
console.error(err);
|
||||
@@ -39,7 +39,7 @@ class ScenariosController{
|
||||
* @memberof ScenariosController
|
||||
*/
|
||||
router.post('/', async (req, res)=>{
|
||||
let result = await scenarios.list(req.body);
|
||||
let result = await scenario.list(req.body);
|
||||
res.json(result);
|
||||
})
|
||||
|
||||
@@ -51,7 +51,7 @@ class ScenariosController{
|
||||
* @memberof ScenariosController
|
||||
*/
|
||||
router.get('/:id', async (req, res)=>{
|
||||
let object = await scenarios.read(parseInt(req.params.id));
|
||||
let object = await scenario.read(parseInt(req.params.id));
|
||||
res.json(object);
|
||||
})
|
||||
|
||||
@@ -62,7 +62,7 @@ class ScenariosController{
|
||||
* @memberof ScenariosController
|
||||
*/
|
||||
router.delete('/:id', async (req, res)=>{
|
||||
await gameObject.remove(req.params.id);
|
||||
await scenario.remove(req.params.id);
|
||||
res.json({status: 'OK'});
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user