Nav apraksta

member.js 642B

12345678910111213141516171819202122232425
  1. var mongoose = require('mongoose');
  2. var Member = new mongoose.Schema({
  3. name: String,
  4. email: { type: String, unique: true },
  5. password: String,
  6. salt: String,
  7. gender: Number,
  8. birthday: Date,
  9. hashname: { type: String },
  10. phone: String,
  11. idno: String,
  12. tokens: [ String ],
  13. rule_tokens: [{ name: String, token: String, expired: Date }],
  14. disabled: { type: Boolean, default: false },
  15. created: { type: Date, default: Date.now },
  16. updated: { type: Date, default: Date.now }
  17. });
  18. Member.methods.validPassword = function(password) {
  19. return (this.password == password) ? true : false;
  20. };
  21. module.exports = mongoose.model('Member', Member);