2023-12-07 12:04:19 +01:00
|
|
|
const express = require( 'express' );
|
|
|
|
const fs=require('fs-extra');
|
2024-10-16 12:55:17 +02:00
|
|
|
const conf = require(`../../../adminapi/objects/tribes/itm/adminapi.json`);
|
2023-12-07 12:04:19 +01:00
|
|
|
|
|
|
|
// Classes
|
|
|
|
const Nations = require( '../models/Nations.js' );
|
|
|
|
// Middlewares
|
|
|
|
const checkHeaders = require( '../middlewares/checkHeaders' );
|
|
|
|
const isAuthenticated = require( '../middlewares/isAuthenticated' );
|
|
|
|
const router = express.Router();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Manage nation
|
|
|
|
A major create a nation with at least a town => nation:{name, towns:[]} contracts/nationname.js + contracts/townsname.js
|
|
|
|
Manage a new towns in a nation => update nation:[nationname:towns:[]} contracts/townname.js
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2024-03-15 08:49:23 +01:00
|
|
|
* @api {put} adminapi/nations/viewtown/:town - nationlist from a town major
|
2023-12-07 12:04:19 +01:00
|
|
|
* @apigroup Nation
|
|
|
|
* @apiName nationlist
|
|
|
|
* @apiDescription get list of nation from a town to help this instance to update network topology
|
|
|
|
* @apiParam {string} town fromwhich the data come from
|
|
|
|
* @apiSuccess {object} refreshnetworktopoly
|
|
|
|
* * HTTP/1.1 200 OK
|
|
|
|
* {status:200,ref:"Nations",msg:"updated",data:{}};
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
router.put( '/', checkHeaders, isAuthenticated, ( req, res ) => {
|
|
|
|
const uptown = Nations.updatetown()
|
|
|
|
res.status(uptown.status).send(uptown)
|
|
|
|
} )
|
|
|
|
|
|
|
|
module.exports = router;
|