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

Function configureModel

lib/application.js:573–595  ·  view source on GitHub ↗
(ModelCtor, config, app)

Source from the content-addressed store, hash-verified

571}
572
573function configureModel(ModelCtor, config, app) {
574 assert(ModelCtor.prototype instanceof ModelCtor.registry.getModel('Model'),
575 ModelCtor.modelName + ' must be a descendant of loopback.Model');
576
577 let dataSource = config.dataSource;
578
579 if (dataSource) {
580 if (typeof dataSource === 'string') {
581 dataSource = app.dataSources[dataSource];
582 }
583
584 assert(
585 dataSource instanceof DataSource,
586 ModelCtor.modelName + ' is referencing a dataSource that does not exist: "' +
587 config.dataSource + '"',
588 );
589 }
590
591 config = extend({}, config);
592 config.dataSource = dataSource;
593
594 app.registry.configureModel(ModelCtor, config);
595}
596
597function clearHandlerCache(app) {
598 app._handlers = undefined;

Callers 1

application.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…