Auto-load and register built-in `Checkpoint` model
This commit is contained in:
parent
242b44ed2b
commit
df9fe90d35
|
@ -441,7 +441,7 @@ Change.rectifyAll = function(cb) {
|
||||||
Change.getCheckpointModel = function() {
|
Change.getCheckpointModel = function() {
|
||||||
var checkpointModel = this.Checkpoint;
|
var checkpointModel = this.Checkpoint;
|
||||||
if(checkpointModel) return checkpointModel;
|
if(checkpointModel) return checkpointModel;
|
||||||
this.checkpoint = checkpointModel = require('./checkpoint').extend('checkpoint');
|
this.checkpoint = checkpointModel = loopback.Checkpoint.extend('checkpoint');
|
||||||
assert(this.dataSource, 'Cannot getCheckpointModel(): ' + this.modelName
|
assert(this.dataSource, 'Cannot getCheckpointModel(): ' + this.modelName
|
||||||
+ ' is not attached to a dataSource');
|
+ ' is not attached to a dataSource');
|
||||||
checkpointModel.attachTo(this.dataSource);
|
checkpointModel.attachTo(this.dataSource);
|
||||||
|
|
|
@ -8,6 +8,7 @@ module.exports = function(loopback) {
|
||||||
loopback.ACL = require('../common/models/acl').ACL;
|
loopback.ACL = require('../common/models/acl').ACL;
|
||||||
loopback.Scope = require('../common/models/acl').Scope;
|
loopback.Scope = require('../common/models/acl').Scope;
|
||||||
loopback.Change = require('../common/models/change');
|
loopback.Change = require('../common/models/change');
|
||||||
|
loopback.Checkpoint = require('../common/models/checkpoint');
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Automatically attach these models to dataSources
|
* Automatically attach these models to dataSources
|
||||||
|
|
|
@ -2,7 +2,7 @@ var async = require('async');
|
||||||
var loopback = require('../');
|
var loopback = require('../');
|
||||||
|
|
||||||
// create a unique Checkpoint model
|
// create a unique Checkpoint model
|
||||||
var Checkpoint = require('../common/models/checkpoint').extend('TestCheckpoint');
|
var Checkpoint = loopback.Checkpoint.extend('TestCheckpoint');
|
||||||
Checkpoint.attachTo(loopback.memory());
|
Checkpoint.attachTo(loopback.memory());
|
||||||
|
|
||||||
describe('Checkpoint', function() {
|
describe('Checkpoint', function() {
|
||||||
|
|
Loading…
Reference in New Issue