fix Odmdb search + schema/articles misformated json

This commit is contained in:
philc 2025-03-29 11:52:12 +01:00
parent 38587df7e9
commit ae9d7fd127
2 changed files with 141 additions and 134 deletions

View File

@ -273,6 +273,8 @@ Odmdb.Schema = (objectPathname, validschema, lg = "en") => {
data: { objectPathname: path.resolve(objectPathname), schema: {} },
};
}
// get $ref from $def
if (res.data.schema["$defs"]) {
Object.keys(res.data.schema["$defs"]).forEach((ss) => {
@ -333,7 +335,7 @@ Odmdb.Schema = (objectPathname, validschema, lg = "en") => {
status: 406,
ref: "Odmdb",
msg: "missingprimarykey",
data: {},
data: {schemakeyfound:Object.keys(res.data.schema)},
};
}
if (res.data.schema.apxidx) {
@ -344,7 +346,7 @@ Odmdb.Schema = (objectPathname, validschema, lg = "en") => {
status: 406,
ref: "Odmdb",
msg: "missingapxuniquekey",
data: {},
data: {schemakeyfound:Object.keys(res.data.schema)},
};
}
@ -428,10 +430,12 @@ Odmdb.search = (objectPathname, objsearch, role) => {
objsearch.fields = Object.keys(getschema.data.schema.properties);
}
const ifields = {};
//console.log("accessright",accessright)
subsearch.forEach((i) => {
const ifields = {};
if (fs.existsSync(`${objectPathname}/itm/${i}.json`)) {
const itm = fs.readJSONSync(`${objectPathname}/itm/${i}.json`);
const itmpath=`${objectPathname}/itm/${i}.json`;
if (fs.existsSync(itmpath)) {
const itm = fs.readJSONSync(itmpath);
if (itm.owner && itm.owner == role.xalias) {
role.xprofils.push("owner");
} else {

View File

@ -85,6 +85,7 @@
"minimum": 0,
"maximum": 4
}
}
},
"articlevalue": {
"type": "float",
@ -204,7 +205,7 @@
"privatecontent"
]
},
"persons": {
"anonymous": {
"R": [
"articleid",
"title",
@ -214,11 +215,13 @@
"author",
"dt_publish",
"manualkeywords",
"autokeywords",
"articleevaluations",
"publiccontent",
"privatecontent",
"comments",
"articlevalue"
]
}
}
}
}