user_permission.js 508 B

12345678910111213141516171819202122232425262728
  1. // Objection Docs:
  2. // http://vincit.github.io/objection.js/
  3. const db = require('../db');
  4. const Model = require('objection').Model;
  5. Model.knex(db);
  6. class UserPermission extends Model {
  7. $beforeInsert () {
  8. this.created_on = Model.raw('NOW()');
  9. this.modified_on = Model.raw('NOW()');
  10. }
  11. $beforeUpdate () {
  12. this.modified_on = Model.raw('NOW()');
  13. }
  14. static get name () {
  15. return 'UserPermission';
  16. }
  17. static get tableName () {
  18. return 'user_permission';
  19. }
  20. }
  21. module.exports = UserPermission;