1
0
forked from apxtri/apxtri

clean odmdb.js

This commit is contained in:
philc 2024-03-07 08:00:02 +01:00
parent a2ceae118e
commit 17a1978dd4

View File

@ -24,7 +24,7 @@ const router = express.Router();
*/ */
router.get("/objects", checkHeaders, isAuthenticated, (req, res) => { router.get("/objects", checkHeaders, isAuthenticated, (req, res) => {
const data = { const data = {
tribe: req.session.headers.xtribe, tribe: req.session.header.xtribe,
apx: { conf: {}, objectnames: [] }, apx: { conf: {}, objectnames: [] },
tribe: { conf: {}, objectnames: [] }, tribe: { conf: {}, objectnames: [] },
}; };
@ -37,7 +37,7 @@ router.get("/objects", checkHeaders, isAuthenticated, (req, res) => {
} }
}); });
glob glob
.sync(`../nationchains/tribes/${req.session.headers.xtribe}/schema/*.json`) .sync(`../nationchains/tribes/${req.session.header.xtribe}/schema/*.json`)
.forEach((f) => { .forEach((f) => {
const objectname = path.basename(f, ".json"); const objectname = path.basename(f, ".json");
if (objectname == "conf") { if (objectname == "conf") {
@ -80,7 +80,7 @@ router.get(
// indexname = objectname_key_value.json // indexname = objectname_key_value.json
let objectLocation = "../nationchains/"; let objectLocation = "../nationchains/";
if (!conf.api.nationObjects.includes(req.params.objectname)) { if (!conf.api.nationObjects.includes(req.params.objectname)) {
objectLocation += `tribes/${req.session.headers.xtribe}/`; objectLocation += `tribes/${req.session.header.xtribe}/`;
// check if accessright // check if accessright
} }
const indexpath = `${objectLocation}/${req.params.objectname}/idx/${req.params.indexname}`; const indexpath = `${objectLocation}/${req.params.objectname}/idx/${req.params.indexname}`;