From 53d8a18536b1754e0bcbe28214726e9a1f822b4b Mon Sep 17 00:00:00 2001 From: philc Date: Fri, 27 Sep 2024 09:17:20 +0200 Subject: [PATCH] fix bug in Odbmdb cud --- models/Checkjson.js | 2 +- models/Odmdb.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/models/Checkjson.js b/models/Checkjson.js index 61737c9..fa26e8f 100755 --- a/models/Checkjson.js +++ b/models/Checkjson.js @@ -206,7 +206,7 @@ Checkjson.schema.data = (schema, data, withschemacheck) => { // subdata={prop1,prop2} // Return [] => no error, else 1 item per error {msg,ref:checkjson,data} const propertielist = Object.keys(properties); - + console.log(propertielist); Object.keys(subdata).forEach((kdata) => { if (!propertielist.includes(kdata)) { delete subdata[kdata]; diff --git a/models/Odmdb.js b/models/Odmdb.js index ed65809..3685897 100644 --- a/models/Odmdb.js +++ b/models/Odmdb.js @@ -666,7 +666,8 @@ Odmdb.cud = (objectPathname, crud, itm, role, runindex = true) => { //console.log("itm",itm) //console.log(accessright) accessright.U.forEach(async (p) => { - itmtostore[p] = itm[p]; + // check this propertie exist in the requested update itm + if (itm[p] && itm[p] != "") itmtostore[p] = itm[p]; }); itmtostore.dt_update = dayjs().toISOString(); } @@ -712,7 +713,7 @@ Odmdb.cud = (objectPathname, crud, itm, role, runindex = true) => { }); if (crud == "C") itmtostore.dt_create = dayjs().toISOString(); // check consistency of datatostore - console.log("itmstostore::::::", itmtostore); + //console.log("itmstostore::::::", itmtostore); const chkdata = Checkjson.schema.data( getschema.data.schema, itmtostore,