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

View File

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