(Model, updates, callback)
| 1480 | }; |
| 1481 | |
| 1482 | function buildLookupOfAffectedModelData(Model, updates, callback) { |
| 1483 | const idName = Model.dataSource.idName(Model.modelName); |
| 1484 | const affectedIds = updates.map(function(u) { return u.change.modelId; }); |
| 1485 | const whereAffected = {}; |
| 1486 | whereAffected[idName] = {inq: affectedIds}; |
| 1487 | Model.find({where: whereAffected}, function(err, affectedList) { |
| 1488 | if (err) return callback(err); |
| 1489 | const dataLookup = {}; |
| 1490 | affectedList.forEach(function(it) { |
| 1491 | dataLookup[it[idName]] = it; |
| 1492 | }); |
| 1493 | callback(null, dataLookup); |
| 1494 | }); |
| 1495 | } |
| 1496 | |
| 1497 | function applyUpdate(Model, id, current, data, change, conflicts, options, cb) { |
| 1498 | const Change = Model.getChangeModel(); |
no outgoing calls
no test coverage detected
searching dependent graphs…