Created
February 16, 2018 19:23
-
-
Save aluzed/7e8b11f0c7c1fdaaafd32402505122ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { ColumnMissing } = require('massive-collections/errors.js'); | |
const Collection = require('massive-collections'); | |
module.exports = (app) => { | |
// Get our db from app object | |
const db = app.get('db'); | |
const Users = new Collection('users', db); | |
/** | |
* Before each update, update modified field | |
*/ | |
Users.preHook('update', function (next, data) { | |
data.modified = new Date(); | |
next(data); | |
}); | |
return Users; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment