Skip to content

Instantly share code, notes, and snippets.

@Faizanq
Created October 25, 2018 08:31
Show Gist options
  • Save Faizanq/af95111addfddc21a67f22a0a8da5f57 to your computer and use it in GitHub Desktop.
Save Faizanq/af95111addfddc21a67f22a0a8da5f57 to your computer and use it in GitHub Desktop.
hooks : {
beforeCreate : (record, options) => {
record.dataValues.createdAt = Math.floor(Date.now() / 1000);
record.dataValues.updatedAt = Math.floor(Date.now() / 1000);
},
beforeUpdate : (record, options) => {
record.dataValues.updatedAt = Math.floor(Date.now() / 1000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment