update schema et odmdb

This commit is contained in:
2024-11-11 00:33:30 +01:00
parent fe82e06cc3
commit 5a6d49d072
19 changed files with 3411 additions and 25 deletions

View File

@@ -183,7 +183,7 @@ Odmdb.Schema = (objectPathname, validschema, lg = "en") => {
if (schemaPath.substring(0, 4) == "http") {
// lance requete http pour recuperer le schema avec un await axios
} else {
schemaPath = `../../${schemaPath}`;
schemaPath = `../${schemaPath}`;
/*if (log)
console.log(
currentmod,
@@ -227,13 +227,13 @@ Odmdb.Schema = (objectPathname, validschema, lg = "en") => {
propertie.comment = `options:${propertie.options["$ref"]}}`;
optionstype = "options";
optionsfile = path.resolve(
`../../${propertie.options["$ref"]}_${lg}.json`
`../${propertie.options["$ref"]}_${lg}.json`
);
}
if (propertie.options["$ref"].includes("/idx/")) {
(propertie.comment = `itms:${propertie.options["$ref"]}}`),
(optionstype = "idx");
optionsfile = path.resolve(`../../${propertie.options["$ref"]}.json`);
optionsfile = path.resolve(`../${propertie.options["$ref"]}.json`);
}
//if (log) console.log(currentmod, "Lien vers options:", optionsfile);
if (!fs.existsSync(optionsfile)) {
@@ -352,7 +352,7 @@ Odmdb.Schema = (objectPathname, validschema, lg = "en") => {
if (!res.data.schema.apxuniquekey.includes(res.data.schema.apxid)) {
res.data.schema.apxuniquekey.push(res.data.schema.apxid);
}
//`../../${req.session.header.xtribe}/objects/persons`
//`../${req.session.header.xtribe}/objects/persons`
res.data.schema.apxidx.forEach((idx) => {
if (
idx.objkey &&
@@ -776,7 +776,10 @@ Odmdb.runidx = (objectPathname, schema) => {
//if (log) console.log(currentmod, `idx for ${objectPathname}`);
if (!schema || !schema.apxid) {
const getschema = Odmdb.Schema(objectPathname, true);
if (getschema.status != 200) return getschema;
if (getschema.status != 200) {
console.log(getschema)
return getschema;
}
schema = getschema.data.schema;
}
const ventil = {};
@@ -791,7 +794,7 @@ Odmdb.runidx = (objectPathname, schema) => {
ventil[id.name].filter = id.filter ? id.filter.replace(/;/g, "") : ""; // check integrity of string
ventil[id.name].data = {};
} else {
if (schema.properties[id.keyval]){
if (!schema.properties[id.keyval]){
console.log(`Check ${objectPathname} index ${id.name} property ${id.keyval} does not exist`)
process.exit(0)
}