modification mineur

This commit is contained in:
2024-09-04 09:06:17 +02:00
parent 4fb624162e
commit f8cb3a9580
15 changed files with 98 additions and 224 deletions

View File

@@ -102,7 +102,7 @@ router.get(
);
/**
* @api {get} /api/adminapi/odmdb/idx/:tribe/:objectname/:indexname - index Get
* @api {get} adminapi/odmdb/idx/:tribe/:objectname/:indexname - index Get
* @apiGroup Odmdb
* @apiName getIndexbyindexname
* @apiDescription Get index file for an object
@@ -421,12 +421,13 @@ router.get(
xalias: req.session.header.xalias,
}
);
res.status(200).json({
res.status(readobj.status).json(readobj);
/*res.status(200).json({
status: 200,
ref: "Odmdb",
msg: "itmfound",
data: fs.readJsonSync(objectpath),
});
});*/
} else {
res.status(404).json({
status: 404,
@@ -438,11 +439,11 @@ router.get(
}
);
/**
* @api {get} https://wall-ants.ndda.fr/adminapi/Checkjson.js - schema Checkjson.js
* @api {get} https://anypaxtridns/adminapi/Checkjson.js - schema Checkjson.js
* @apiGroup Odmdb
* @apiName checkjsonjs
* @apiDescription Public js lib to import in a browser by :<br>
* ```<script src="https://wall-ants.ndda.fr/adminapi/Checkjson.js"></script>```
* ```<script src="/adminapi/Checkjson.js"></script>```
* to import in a node.js:<br>
* ```const Checkjson = require(`Checkjson.js`);```
*
@@ -456,8 +457,12 @@ router.get(
* - {status:417, multimsg:[{ref:"Checkjson",msg:"errorkey",data:{}}]}<br>
*
* To identify issues, get the language errorkey list with a get
* MUST BE UPDATE with conf access https://wall-ants.ndda.fr/adminapi/objects/tplstring/Checkjson_lg.json
*
*
* To check a property from an existing format
*
* Checkjson.testformat=(str, format)=>{
* return null if format does not exist in Checkjson.schema.properties.format
* return true if str respect the format (false in other case)
*/
/**

View File

@@ -14,14 +14,10 @@ const currentmod = "pagans";
const log = conf.api.activelog.includes(currentmod);
const router = express.Router();
/**
* /api/models/Pagans.js
*
* Managed:
/**
* Alias exist then return public key or not
* @api {get} /api/adminapi/pagans/alias/:alias - alias Get
* @api {get} adminapi/pagans/alias/:alias - alias Get
* @apiName isalias
* @apiGroup Pagans
* @apiDescription If alias exist return its publickey
@@ -44,7 +40,7 @@ router.get("/alias/:alias", (req, res) => {
res.status(getalias.status).send(getalias);
});
/**
* @api {get} /api/adminapi/pagans/logout - pagan Logout
* @api {get} adminapi/pagans/logout - pagan Logout
* @apiName Removetoken
* @apiGroup Pagans
* @apiDescription Remove server's token only the owner of the token (no one else can delete a token )
@@ -66,7 +62,7 @@ router.get("/logout", checkHeaders, isAuthenticated, (req, res) => {
res.status(logout.status).json(logout);
});
/**
* @api {get} /api/adminapi/pagans/isauth - pagan isAuthenticated?
* @api {get} adminapi/pagans/isauth - pagan isAuthenticated?
* @apiName isAuth
* @apiGroup Pagans
* @apiDescription Check if pagan's token is still valid
@@ -92,10 +88,9 @@ router.get("/isauth", checkHeaders, isAuthenticated, (req, res) => {
},
});
});
// @a pi Body {object} schema:pagans <a href='/nationchains/schema/pagans.json' target='_blank'>/nationchains/schema/pagans.json</a>
/**
* @api {post} /api/adminapi/pagans - pagan Post
* @api {post} adminapi/pagans - pagan Post
* @apiName addpagan
* @apiGroup Pagans
* @apiDescription
@@ -217,7 +212,7 @@ router.post("/", checkHeaders, isAuthenticated, async (req, res) => {
}
});
/**
* @api {delete} /api/adminapi/pagans/alias/:alias - pagan Delete
* @api {delete} adminapi/pagans/alias/:alias - pagan Delete
* @apiName deletepagan
* @apiGroup Pagans
* @apiDescription
@@ -253,7 +248,7 @@ router.delete("/alias/:alias", checkHeaders, isAuthenticated, (req, res) => {
res.status(result.status).send(result);
});
/**
* @api {delete} /api/adminapi/pagans/person/:tribe/:alias - person Delete
* @api {delete} adminapi/pagans/person/:tribe/:alias - person Delete
* @apiName deleteperson
* @apiGroup Pagans
* @apiDescription
@@ -292,7 +287,7 @@ router.delete(
);
/**
* @api {get} /api/adminapi/pagans/person/:alias - person Get
* @api {get} adminapi/pagans/person/:alias - person Get
* @apiName getpersondata
* @apiDescription Get person information from his alias for a xtribe (data and profils per apps)
* @apiGroup Pagans
@@ -324,7 +319,7 @@ router.get("/person/:alias", checkHeaders, isAuthenticated, (req, res) => {
});
/**
* @api {put} /api/adminapi/pagans/person/:tribe - person Put
* @api {put} adminapi/pagans/person/:tribe - person Put
* @apiName updateperson
* @apiGroup Pagans
* @apiDescription add a person = alias in tribe. xalias must be authenticated. This end point have to be use the first time a person is create then use item Update PUT /api/adminapi/odmdb/itm/:tribe/persons.<br> This endpoint is the only way to change profils of a person by itself (authenitcated alias = person.alias) and can be done only with req.body.addprofils req.body.removeprofils.
@@ -401,13 +396,13 @@ router.put("/person/:tribe", checkHeaders, isAuthenticated, (req, res) => {
});
/**
* @api {post} /api/adminapi/pagans/keyrecovery - recovery keys
* @api {post} /adminapi/pagans/keyrecovery - recovery keys
* @apiName recoveryKey
* @apiGroup Pagans
* @apiDescription Send mails with all registers identities (one per alias where recoveryauth.email is register). Search can be request by email or by alias for a tribe. It is looking for in person.recoveryauth.email to send keys. One mail is sent by alias. So if n alias has the same recoveryaut.email then it will send n email.
* @apiBody {string} emailalias type of search (email or alias)
* @apiBody {string} tribe tribename into looking for
* @apiBody {string} search an email or an alias
* @apiBody {string} search a text containing email or an alias to looking for
*
* @apiSuccess {object} send recovery email
* @apiSuccessExample {json} Success-Response:
@@ -420,6 +415,9 @@ router.put("/person/:tribe", checkHeaders, isAuthenticated, (req, res) => {
*
*/
router.post("/keyrecovery", checkHeaders, (req, res) => {
const recores=Pagans.keyrecovery(req.body.emailalias,req.body.tribe,req.body.search,req.session.header.xlang)
res.status(recores.status).json(recores);
/*
let emailist = [];
let alias = req.body.search;
if (req.body.emailalias == "email") {
@@ -448,7 +446,7 @@ router.post("/keyrecovery", checkHeaders, (req, res) => {
});
}
} else {
//console later
res.status(406).json({status:406,ref:"Pagans",msg:"emailaliasnotemailoralias",data:{}})
}
emailist.forEach((e) => {
@@ -471,6 +469,7 @@ router.post("/keyrecovery", checkHeaders, (req, res) => {
data: { tribe: req.body.tribe },
});
}
*/
});
module.exports = router;