2014-10-09 14:51:12 +00:00
|
|
|
module.exports = function(loopback) {
|
2014-10-10 09:53:22 +00:00
|
|
|
// NOTE(bajtos) we must use static require() due to browserify limitations
|
|
|
|
|
2014-10-10 11:49:21 +00:00
|
|
|
loopback.Email = createModel(
|
|
|
|
require('../common/models/email.json'),
|
|
|
|
require('../common/models/email.js'));
|
2014-10-10 09:53:22 +00:00
|
|
|
|
2014-10-13 06:41:31 +00:00
|
|
|
loopback.Application = createModel(
|
|
|
|
require('../common/models/application.json'),
|
|
|
|
require('../common/models/application.js'));
|
|
|
|
|
2014-10-13 08:23:35 +00:00
|
|
|
loopback.AccessToken = createModel(
|
|
|
|
require('../common/models/access-token.json'),
|
|
|
|
require('../common/models/access-token.js'));
|
|
|
|
|
2014-10-13 09:20:04 +00:00
|
|
|
loopback.RoleMapping = createModel(
|
|
|
|
require('../common/models/role-mapping.json'),
|
|
|
|
require('../common/models/role-mapping.js'));
|
|
|
|
|
2014-10-13 09:31:27 +00:00
|
|
|
loopback.Role = createModel(
|
|
|
|
require('../common/models/role.json'),
|
|
|
|
require('../common/models/role.js'));
|
2014-10-13 08:55:08 +00:00
|
|
|
|
|
|
|
loopback.ACL = createModel(
|
|
|
|
require('../common/models/acl.json'),
|
|
|
|
require('../common/models/acl.js'));
|
2014-10-13 08:46:55 +00:00
|
|
|
|
|
|
|
loopback.Scope = createModel(
|
|
|
|
require('../common/models/scope.json'),
|
|
|
|
require('../common/models/scope.js'));
|
2014-10-10 09:53:22 +00:00
|
|
|
|
|
|
|
loopback.User = createModel(
|
|
|
|
require('../common/models/user.json'),
|
|
|
|
require('../common/models/user.js'));
|
|
|
|
|
2014-10-09 15:32:03 +00:00
|
|
|
loopback.Change = require('../common/models/change');
|
2014-10-13 09:45:06 +00:00
|
|
|
|
|
|
|
loopback.Checkpoint = createModel(
|
|
|
|
require('../common/models/checkpoint.json'),
|
|
|
|
require('../common/models/checkpoint.js'));
|
2014-10-09 14:51:12 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* Automatically attach these models to dataSources
|
|
|
|
*/
|
|
|
|
|
|
|
|
var dataSourceTypes = {
|
|
|
|
DB: 'db',
|
|
|
|
MAIL: 'mail'
|
|
|
|
};
|
|
|
|
|
|
|
|
loopback.Email.autoAttach = dataSourceTypes.MAIL;
|
|
|
|
loopback.PersistedModel.autoAttach = dataSourceTypes.DB;
|
|
|
|
loopback.User.autoAttach = dataSourceTypes.DB;
|
|
|
|
loopback.AccessToken.autoAttach = dataSourceTypes.DB;
|
|
|
|
loopback.Role.autoAttach = dataSourceTypes.DB;
|
|
|
|
loopback.RoleMapping.autoAttach = dataSourceTypes.DB;
|
|
|
|
loopback.ACL.autoAttach = dataSourceTypes.DB;
|
|
|
|
loopback.Scope.autoAttach = dataSourceTypes.DB;
|
|
|
|
loopback.Application.autoAttach = dataSourceTypes.DB;
|
2014-10-10 09:53:22 +00:00
|
|
|
|
|
|
|
function createModel(definitionJson, customizeFn) {
|
|
|
|
var Model = loopback.createModel(definitionJson);
|
|
|
|
customizeFn(Model);
|
|
|
|
return Model;
|
|
|
|
}
|
2014-10-09 14:51:12 +00:00
|
|
|
};
|