Advertisement
Guest User

Untitled

a guest
Feb 4th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. var db = require('../bin/db');
  2. var Sequelize = require('sequelize');
  3. var encrypt = require('../bin/encrypt.js');
  4.  
  5. const User = db.define('users', {
  6. email: {
  7. type: Sequelize.STRING,
  8. primaryKey: true,
  9. allowNull: false,
  10. validate: {
  11. isEmail: true
  12. }
  13. },
  14. password: {
  15. type: Sequelize.STRING,
  16. allowNull: false,
  17. set(val) {
  18. this.setDataValue('password', encrypt(val));
  19. }
  20. },
  21. name: {
  22. type: Sequelize.STRING,
  23. allowNull: false
  24. },
  25. });
  26.  
  27. User.sync();
  28.  
  29. module.exports = User;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement