fix Odmdb search + schema/articles misformated json
This commit is contained in:
		| @@ -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 { | ||||
|   | ||||
| @@ -85,140 +85,143 @@ | ||||
|           "minimum": 0, | ||||
|           "maximum": 4 | ||||
|         } | ||||
|       }, | ||||
|       "articlevalue": { | ||||
|         "type": "float", | ||||
|         "minimum": 0, | ||||
|         "maximum": 4 | ||||
|       }, | ||||
|       "followupdate": { | ||||
|         "type": "array", | ||||
|         "items": { | ||||
|           "title": "alias", | ||||
|           "type": "string" | ||||
|         } | ||||
|       }, | ||||
|       "comments": { | ||||
|         "type": "array", | ||||
|         "items": { | ||||
|           "type": "object", | ||||
|           "properties": { | ||||
|             "comments": { | ||||
|               "type": "string", | ||||
|               "maxLength": 250 | ||||
|             }, | ||||
|             "dt_create": { | ||||
|               "title": "Creation date", | ||||
|               "type": "string", | ||||
|               "format": "date-time" | ||||
|             }, | ||||
|             "alias": { | ||||
|               "type": "string" | ||||
|             }, | ||||
|             "commenthash": { | ||||
|               "type": "string" | ||||
|             }, | ||||
|             "answerto": { | ||||
|               "type": "integer", | ||||
|               "title": "position of the comments of this response comment" | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|       }, | ||||
|       "publiccontent": { | ||||
|         "type": "string" | ||||
|       }, | ||||
|       "privatecontent": { | ||||
|       } | ||||
|     }, | ||||
|     "articlevalue": { | ||||
|       "type": "float", | ||||
|       "minimum": 0, | ||||
|       "maximum": 4 | ||||
|     }, | ||||
|     "followupdate": { | ||||
|       "type": "array", | ||||
|       "items": { | ||||
|         "title": "alias", | ||||
|         "type": "string" | ||||
|       } | ||||
|     }, | ||||
|     "required": [ | ||||
|       "articleid", | ||||
|       "owner", | ||||
|       "title", | ||||
|       "description" | ||||
|     ], | ||||
|     "additionalProperties": true, | ||||
|     "apxref": [], | ||||
|     "apxid": "articleid", | ||||
|     "apxuniquekey": [ | ||||
|       "articleid" | ||||
|     ], | ||||
|     "apxidx": [ | ||||
|       { | ||||
|         "name": "lst_articleid", | ||||
|         "type": "array", | ||||
|         "keyval": "articleid" | ||||
|       }, | ||||
|       { | ||||
|         "name": "lst_author", | ||||
|         "type": "array", | ||||
|         "keyval": "author" | ||||
|       }, | ||||
|       { | ||||
|         "name": "articleid", | ||||
|         "type": "view", | ||||
|         "keyval": "articleid", | ||||
|         "objkey": [ | ||||
|           "articleid", | ||||
|           "title", | ||||
|           "description", | ||||
|           "imgseo", | ||||
|           "url", | ||||
|           "author", | ||||
|           "dt_create", | ||||
|           "dt_update", | ||||
|           "dt_publish", | ||||
|           "manualkeywords", | ||||
|           "autokeywords" | ||||
|         ], | ||||
|         "filter": "" | ||||
|       }, | ||||
|       { | ||||
|         "name": "author_articleid", | ||||
|         "type": "distribution", | ||||
|         "keyval": "author", | ||||
|         "filter": "" | ||||
|       }, | ||||
|       { | ||||
|         "name": "manualkeywords_articleid", | ||||
|         "type": "distribution", | ||||
|         "keyval": "manualkeywords", | ||||
|         "filter": "" | ||||
|       } | ||||
|     ], | ||||
|     "apxaccessrights": { | ||||
|       "owner": { | ||||
|         "C": [], | ||||
|         "D": [], | ||||
|         "R": [], | ||||
|         "U": [ | ||||
|           "title", | ||||
|           "description", | ||||
|           "imgseo", | ||||
|           "url", | ||||
|           "author", | ||||
|           "dt_publish", | ||||
|           "manualkeywords", | ||||
|           "publiccontent", | ||||
|           "privatecontent" | ||||
|         ] | ||||
|       }, | ||||
|       "persons": { | ||||
|         "R": [ | ||||
|           "articleid", | ||||
|           "title", | ||||
|           "description", | ||||
|           "imgseo", | ||||
|           "url", | ||||
|           "author", | ||||
|           "dt_publish", | ||||
|           "manualkeywords", | ||||
|           "publiccontent", | ||||
|           "comments", | ||||
|           "articlevalue" | ||||
|         ] | ||||
|     "comments": { | ||||
|       "type": "array", | ||||
|       "items": { | ||||
|         "type": "object", | ||||
|         "properties": { | ||||
|           "comments": { | ||||
|             "type": "string", | ||||
|             "maxLength": 250 | ||||
|           }, | ||||
|           "dt_create": { | ||||
|             "title": "Creation date", | ||||
|             "type": "string", | ||||
|             "format": "date-time" | ||||
|           }, | ||||
|           "alias": { | ||||
|             "type": "string" | ||||
|           }, | ||||
|           "commenthash": { | ||||
|             "type": "string" | ||||
|           }, | ||||
|           "answerto": { | ||||
|             "type": "integer", | ||||
|             "title": "position of the comments of this response comment" | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "publiccontent": { | ||||
|       "type": "string" | ||||
|     }, | ||||
|     "privatecontent": { | ||||
|       "type": "string" | ||||
|     } | ||||
|   }, | ||||
|   "required": [ | ||||
|     "articleid", | ||||
|     "owner", | ||||
|     "title", | ||||
|     "description" | ||||
|   ], | ||||
|   "additionalProperties": true, | ||||
|   "apxref": [], | ||||
|   "apxid": "articleid", | ||||
|   "apxuniquekey": [ | ||||
|     "articleid" | ||||
|   ], | ||||
|   "apxidx": [ | ||||
|     { | ||||
|       "name": "lst_articleid", | ||||
|       "type": "array", | ||||
|       "keyval": "articleid" | ||||
|     }, | ||||
|     { | ||||
|       "name": "lst_author", | ||||
|       "type": "array", | ||||
|       "keyval": "author" | ||||
|     }, | ||||
|     { | ||||
|       "name": "articleid", | ||||
|       "type": "view", | ||||
|       "keyval": "articleid", | ||||
|       "objkey": [ | ||||
|         "articleid", | ||||
|         "title", | ||||
|         "description", | ||||
|         "imgseo", | ||||
|         "url", | ||||
|         "author", | ||||
|         "dt_create", | ||||
|         "dt_update", | ||||
|         "dt_publish", | ||||
|         "manualkeywords", | ||||
|         "autokeywords" | ||||
|       ], | ||||
|       "filter": "" | ||||
|     }, | ||||
|     { | ||||
|       "name": "author_articleid", | ||||
|       "type": "distribution", | ||||
|       "keyval": "author", | ||||
|       "filter": "" | ||||
|     }, | ||||
|     { | ||||
|       "name": "manualkeywords_articleid", | ||||
|       "type": "distribution", | ||||
|       "keyval": "manualkeywords", | ||||
|       "filter": "" | ||||
|     } | ||||
|   ], | ||||
|   "apxaccessrights": { | ||||
|     "owner": { | ||||
|       "C": [], | ||||
|       "D": [], | ||||
|       "R": [], | ||||
|       "U": [ | ||||
|         "title", | ||||
|         "description", | ||||
|         "imgseo", | ||||
|         "url", | ||||
|         "author", | ||||
|         "dt_publish", | ||||
|         "manualkeywords", | ||||
|         "publiccontent", | ||||
|         "privatecontent" | ||||
|       ] | ||||
|     }, | ||||
|     "anonymous": { | ||||
|       "R": [ | ||||
|         "articleid", | ||||
|         "title", | ||||
|         "description", | ||||
|         "imgseo", | ||||
|         "url", | ||||
|         "author", | ||||
|         "dt_publish", | ||||
|         "manualkeywords", | ||||
|         "autokeywords", | ||||
|         "articleevaluations", | ||||
|         "publiccontent", | ||||
|         "privatecontent", | ||||
|         "comments", | ||||
|         "articlevalue" | ||||
|       ] | ||||
|     } | ||||
|   } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user