| 1290 | } |
| 1291 | |
| 1292 | function _checkIdList(document, reqType) { |
| 1293 | try { |
| 1294 | let idList = reqType.save; |
| 1295 | idList = idList.concat(reqType.update); |
| 1296 | if (idList.indexOf(document._id) !== -1 || idList.indexOf(document._hash) !== -1) { |
| 1297 | if (document._isModified) { |
| 1298 | delete document._isModified; |
| 1299 | delete document._modifiedColumns; |
| 1300 | } |
| 1301 | } else { |
| 1302 | for (const key in document) { |
| 1303 | if (document[key]) { |
| 1304 | if (document[key].constructor === Array && document[key].length) { |
| 1305 | if (document[key][0]._tableName) { |
| 1306 | for (let i = 0; i < document[key].length; i++) document[key][i] = _checkIdList(document[key][i], reqType); |
| 1307 | } |
| 1308 | } |
| 1309 | if (typeof document[key] === 'object' && document[key] != null) { |
| 1310 | if (document[key]._type) { |
| 1311 | document[key] = _checkIdList(document[key], reqType); |
| 1312 | } |
| 1313 | } |
| 1314 | } |
| 1315 | } |
| 1316 | } |
| 1317 | return document; |
| 1318 | } catch (err) { |
| 1319 | winston.log('error', { |
| 1320 | error: String(err), |
| 1321 | stack: new Error().stack, |
| 1322 | }); |
| 1323 | return null; |
| 1324 | } |
| 1325 | } |
| 1326 | |
| 1327 | /* Desc : Filter and return unique objects |
| 1328 | Params : objectsList |