This commit is contained in:
2024-04-12 12:49:48 +02:00
parent 4c959380b6
commit 52fcf0d9aa
9 changed files with 221 additions and 187 deletions

View File

@@ -302,16 +302,14 @@ router.get(
* @apiParam {String} objectname name Mandatory if in conf.nationObjects then file is into nationchains/ else in /tribes/xtribe/objectname
* @apiParam {String} primaryindex the unique id where item is store
*
* @apiError {json} objectNotfound the file item does not exist
* @apiError {json} objectfiledoesnotexist the file item does not exist
* @apiErrorExample {json}
* HTTP/1.1 404 Not Found
* {"status":404,"ref":"Odmdb","msg":"doesnotexist","data":{"objectname":"objectname","key":"apxid","val":"primaryindex"}}
*
* {status:404,ref: "Odmdb",msg: "objectfiledoesnotexist",data: { objectpath }}
* @apiSuccess {object} indexfile content
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* {"status":200, "ref":"Odmdb", "msg":"indexexist", "data":{"indexname","content":{itm file}}
*
* {status:200,ref:"Odmdb",msg:"itmfound", data:{itm:{} }} *
*
*/
// indexname = objectname_key_value.json
@@ -323,9 +321,10 @@ router.get(
const objectpath = `../../${req.params.tribe}/objects/${req.params.objectname}/itm/${req.params.primaryindex}.json`;
if (fs.existsSync(objectpath)) {
res.status(200).json({ data: fs.readJsonSync(objectpath) });
res.status(200).json({status:200,ref:"Odmdb",msg:"itmfound", data:{itm: fs.readJsonSync(objectpath) }});
} else {
res.status(404).json({
status:404,
ref: "Odmdb",
msg: "objectfiledoesnotexist",
data: { objectpath },

View File

@@ -234,6 +234,8 @@ router.post( '/downloadls', checkHeaders, isAuthenticated, ( req, res ) => {
.send( 'Forbidden access' )
}
} );
router.post( '/upfilepond', checkHeaders, isAuthenticated, ( req, res ) => {
console.log( 'post adminapi/tribes/uploadfilepond' );
// Store file and return a unique id to save button