fix Odmdb search + schema/articles misformated json
This commit is contained in:
parent
38587df7e9
commit
ae9d7fd127
@ -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 {
|
||||||
|
@ -85,140 +85,143 @@
|
|||||||
"minimum": 0,
|
"minimum": 0,
|
||||||
"maximum": 4
|
"maximum": 4
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"articlevalue": {
|
},
|
||||||
"type": "float",
|
"articlevalue": {
|
||||||
"minimum": 0,
|
"type": "float",
|
||||||
"maximum": 4
|
"minimum": 0,
|
||||||
},
|
"maximum": 4
|
||||||
"followupdate": {
|
},
|
||||||
"type": "array",
|
"followupdate": {
|
||||||
"items": {
|
"type": "array",
|
||||||
"title": "alias",
|
"items": {
|
||||||
"type": "string"
|
"title": "alias",
|
||||||
}
|
|
||||||
},
|
|
||||||
"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"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"comments": {
|
||||||
"articleid",
|
"type": "array",
|
||||||
"owner",
|
"items": {
|
||||||
"title",
|
"type": "object",
|
||||||
"description"
|
"properties": {
|
||||||
],
|
"comments": {
|
||||||
"additionalProperties": true,
|
"type": "string",
|
||||||
"apxref": [],
|
"maxLength": 250
|
||||||
"apxid": "articleid",
|
},
|
||||||
"apxuniquekey": [
|
"dt_create": {
|
||||||
"articleid"
|
"title": "Creation date",
|
||||||
],
|
"type": "string",
|
||||||
"apxidx": [
|
"format": "date-time"
|
||||||
{
|
},
|
||||||
"name": "lst_articleid",
|
"alias": {
|
||||||
"type": "array",
|
"type": "string"
|
||||||
"keyval": "articleid"
|
},
|
||||||
},
|
"commenthash": {
|
||||||
{
|
"type": "string"
|
||||||
"name": "lst_author",
|
},
|
||||||
"type": "array",
|
"answerto": {
|
||||||
"keyval": "author"
|
"type": "integer",
|
||||||
},
|
"title": "position of the comments of this response comment"
|
||||||
{
|
}
|
||||||
"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"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"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"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user