modif odmdb accessright
This commit is contained in:
@@ -228,8 +228,47 @@ router.get(
|
||||
router.post("/itm/:objectname", checkHeaders, isAuthenticated, (req, res) => {
|
||||
// Create an item of an object with no specificities
|
||||
// if specificities then create a route / model that import odmdb
|
||||
res.json({});
|
||||
const objectPathname=`../../${req.session.header.xtribe}/objects/${req.params.objectname}`;
|
||||
const postitm=Odmdb.cud(objectPathname,"C",req.body,{xprofils:req.session.header.xprofils,xalias:req.session.header.xalias});
|
||||
res.status(postitm.status).json(postitm);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @api {put} /adminapi/odmdb/itm/:objectname - item Update
|
||||
* @apiGroup Odmdb
|
||||
* @apiName putItm
|
||||
* @apiPermission none
|
||||
* @apiDescription Update an item (data) into a collection of objectname items. Before Check data integrity with the relevant schema.
|
||||
* Then create a new primarykey. For multilanguage return see nationchains/model/lg/Odmdb_xx.json.
|
||||
*
|
||||
* @apiParam {string} objectname Place where to create new item, schema and version are available in /objectname/conf.json
|
||||
*
|
||||
* @apiBody {Object} data must pass Checkjson.js with schema
|
||||
*
|
||||
* @apiSuccess {json} data idxprimary Value of idxprimary into objectname collection
|
||||
* @apiSuccessExample {json} Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
* {"status":200, "ref":"Odmdb", "msg":"cudsuccessfull", "data":{"itm":{}}}
|
||||
*
|
||||
* @apiError {json} schemanotfound The objectname schema is not found
|
||||
* @apiError {json} pathnamedoesnotexist The objectname does not exist for the tribe
|
||||
* @apiError {json} missingprimarykey Body data must have primarykey to be created
|
||||
* @apiError {json} unconsistencyapxidx some Body data get unique key that already exist
|
||||
* @apiError {json} checkjsonfalse The body data are not consistent with the schema
|
||||
* @apiErrorExample {json}
|
||||
* HTTP/1.1 404 Not Found
|
||||
* {"status":404,"ref":"Odmdb","msg":"see nationchains/model/lg/Odmdb_xx.json","data":"object to render with msg"}
|
||||
*
|
||||
*/
|
||||
router.put("/itm/:objectname", checkHeaders, isAuthenticated, (req, res) => {
|
||||
// Create an item of an object with no specificities
|
||||
// if specificities then create a route / model that import odmdb
|
||||
const objectPathname=`../../${req.session.header.xtribe}/objects/${req.params.objectname}`;
|
||||
const postitm=Odmdb.cud(objectPathname,"U",req.body,{xprofils:req.session.header.xprofils,xalias:req.session.header.xalias});
|
||||
res.status(postitm.status).json(postitm);
|
||||
});
|
||||
|
||||
router.get(
|
||||
"/searchitems/:objectname/:question",
|
||||
checkHeaders,
|
||||
|
Reference in New Issue
Block a user