Guest User

Untitled

a guest
Apr 18th, 2017
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. "use strict";
  2.  
  3. var sequelize = require("./index.js");
  4. var Note = require("./note");
  5. var Sequelize = require("sequelize");
  6.  
  7. var User = sequelize.define('users', {
  8. id: {
  9. type: Sequelize.INTEGER(),
  10. autoIncrement: true,
  11. primaryKey: true,
  12. field: 'id'
  13. },
  14. username: {
  15. type: Sequelize.STRING(),
  16. field: 'username'
  17. },
  18. password: {
  19. type: Sequelize.STRING(),
  20. field: 'password'
  21. },
  22. email: {
  23. type: Sequelize.STRING(),
  24. field: 'email'
  25. },
  26. firstName: {
  27. type: Sequelize.STRING(),
  28. field: 'first_name'
  29. },
  30. lastName: {
  31. type: Sequelize.STRING(),
  32. field: 'last_name'
  33. }
  34. }, {
  35. freezeTableName: true // Model tableName will be the same as the model name
  36. }
  37. // },{
  38. // classMethods: {
  39. // associate: function(models) {
  40. // User.hasMany(models.Notes, {through: 'user_notes'});
  41. // }
  42. // },
  43. // instanceMethods: {
  44. // retrieveAll: function(onSuccess, onError) {
  45. // User.findAll().then(onSuccess).error(onError);
  46. // }
  47. // }
  48.  
  49.  
  50.  
  51. );
  52.  
  53.  
  54. User.belongsToMany(Note, {through: 'user_notes'});
  55.  
  56.  
  57. module.exports = User;
Add Comment
Please, Sign In to add comment