2015-04-01 21:50:36 +00:00
|
|
|
module.exports = function(registry) {
|
2014-10-10 09:53:22 +00:00
|
|
|
// NOTE(bajtos) we must use static require() due to browserify limitations
|
|
|
|
|
2015-04-01 21:50:36 +00:00
|
|
|
registry.Email = createModel(
|
2014-10-10 11:49:21 +00:00
|
|
|
require('../common/models/email.json'),
|
|
|
|
require('../common/models/email.js'));
|
2014-10-10 09:53:22 +00:00
|
|
|
|
2015-04-01 21:50:36 +00:00
|
|
|
registry.Application = createModel(
|
2014-10-13 06:41:31 +00:00
|
|
|
require('../common/models/application.json'),
|
|
|
|
require('../common/models/application.js'));
|
|
|
|
|
2015-04-01 21:50:36 +00:00
|
|
|
registry.AccessToken = createModel(
|
2014-10-13 08:23:35 +00:00
|
|
|
require('../common/models/access-token.json'),
|
|
|
|
require('../common/models/access-token.js'));
|
|
|
|
|
2015-05-29 23:44:18 +00:00
|
|
|
registry.User = createModel(
|
2015-03-13 15:50:30 +00:00
|
|
|
require('../common/models/user.json'),
|
|
|
|
require('../common/models/user.js'));
|
|
|
|
|
2015-04-01 21:50:36 +00:00
|
|
|
registry.RoleMapping = createModel(
|
2014-10-13 09:20:04 +00:00
|
|
|
require('../common/models/role-mapping.json'),
|
|
|
|
require('../common/models/role-mapping.js'));
|
|
|
|
|
2015-04-01 21:50:36 +00:00
|
|
|
registry.Role = createModel(
|
2014-10-13 09:31:27 +00:00
|
|
|
require('../common/models/role.json'),
|
|
|
|
require('../common/models/role.js'));
|
2014-10-13 08:55:08 +00:00
|
|
|
|
2015-04-01 21:50:36 +00:00
|
|
|
registry.ACL = createModel(
|
2014-10-13 08:55:08 +00:00
|
|
|
require('../common/models/acl.json'),
|
|
|
|
require('../common/models/acl.js'));
|
2014-10-13 08:46:55 +00:00
|
|
|
|
2015-04-01 21:50:36 +00:00
|
|
|
registry.Scope = createModel(
|
2014-10-13 08:46:55 +00:00
|
|
|
require('../common/models/scope.json'),
|
|
|
|
require('../common/models/scope.js'));
|
2014-10-10 09:53:22 +00:00
|
|
|
|
2015-04-01 21:50:36 +00:00
|
|
|
registry.Change = createModel(
|
2014-10-13 09:58:14 +00:00
|
|
|
require('../common/models/change.json'),
|
|
|
|
require('../common/models/change.js'));
|
2014-10-13 09:45:06 +00:00
|
|
|
|
2015-04-01 21:50:36 +00:00
|
|
|
registry.Checkpoint = createModel(
|
2014-10-13 09:45:06 +00:00
|
|
|
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'
|
|
|
|
};
|
|
|
|
|
2015-04-01 21:50:36 +00:00
|
|
|
registry.Email.autoAttach = dataSourceTypes.MAIL;
|
|
|
|
registry.getModel('PersistedModel').autoAttach = dataSourceTypes.DB;
|
|
|
|
registry.User.autoAttach = dataSourceTypes.DB;
|
|
|
|
registry.AccessToken.autoAttach = dataSourceTypes.DB;
|
|
|
|
registry.Role.autoAttach = dataSourceTypes.DB;
|
|
|
|
registry.RoleMapping.autoAttach = dataSourceTypes.DB;
|
|
|
|
registry.ACL.autoAttach = dataSourceTypes.DB;
|
|
|
|
registry.Scope.autoAttach = dataSourceTypes.DB;
|
|
|
|
registry.Application.autoAttach = dataSourceTypes.DB;
|
2014-10-10 09:53:22 +00:00
|
|
|
|
|
|
|
function createModel(definitionJson, customizeFn) {
|
2015-04-01 21:50:36 +00:00
|
|
|
var Model = registry.createModel(definitionJson);
|
2014-10-10 09:53:22 +00:00
|
|
|
customizeFn(Model);
|
|
|
|
return Model;
|
|
|
|
}
|
2014-10-09 14:51:12 +00:00
|
|
|
};
|