Skip to content

Instantly share code, notes, and snippets.

@gaboelnuevo
Created September 13, 2015 23:33
Show Gist options
  • Save gaboelnuevo/7b48ea763a3665f0abfa to your computer and use it in GitHub Desktop.
Save gaboelnuevo/7b48ea763a3665f0abfa to your computer and use it in GitHub Desktop.
mixin: timestamp loopback
module.exports = function(Model, options) {
// Model is the model class
// options is an object containing the config properties from model definition
Model.defineProperty('created', {type: Date, default: '$now'});
Model.defineProperty('modified', {type: Date, default: '$now'});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment