MCPcopy
hub / github.com/strongloop/loopback / buildLookupOfAffectedModelData

Function buildLookupOfAffectedModelData

lib/persisted-model.js:1482–1495  ·  view source on GitHub ↗
(Model, updates, callback)

Source from the content-addressed store, hash-verified

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();

Callers 1

persisted-model.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…