Skip to content

Instantly share code, notes, and snippets.

@pulkitsinghal
pulkitsinghal / 01-override-User-model.js
Created December 2, 2014 03:27
Strongloop/Loopback - Override User model via boot script
module.exports = function(app) {
var User = app.models.User;
// TODO: (1) find an example of how to add new "properties" to the built-in User mode via boot script
// (2) This is how you can add a "relationship" to the built-in User model via boot script
var SomeOtherModel = app.models.SomeOtherModel;
User.hasMany(SomeOtherModel, {as: 'someOtherModels', foreignKey: 'someOtherModelId'});
// (3) This is how you can add "remote methods" to the built-in User model via boot script