You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.6 KiB

  1. var mongoose = require('mongoose'),
  2. Schema = mongoose.Schema;
  3. var mongooseUniqueValidator = require('mongoose-unique-validator');
  4. var userSchema = new Schema({
  5. username: { type: String, required: true, unique: true },
  6. email: { type: String, required: true },
  7. password: { type: String, required: true, select: false },
  8. tokens: [{
  9. userAgent: {type: String, select: false},
  10. token: {type: String, select: false},
  11. os: {type: String, select: false},
  12. browser: {type: String, select: false},
  13. device: {type: String, select: false},
  14. os_version: {type: String, select: false},
  15. browser_version: {type: String, select: false},
  16. ip: {type: String, select: false},
  17. lastLogin: {type: Date, select: false},
  18. birthdate: {type: Date, select: false},
  19. }],
  20. description: { type: String },
  21. img: { type: String, default: "https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png" },
  22. contact: {
  23. twitter: { type: String },
  24. facebook: { type: String },
  25. telegram: { type: String },
  26. web: { type: String },
  27. phone: { type: Number }
  28. },
  29. location:{
  30. direction: { type: String },
  31. city: { type: String },
  32. district: { type: String },
  33. geo: {
  34. lat: {type: Number},
  35. long: {type: Number},
  36. name: { type: String}
  37. }
  38. },
  39. events: [{
  40. type: mongoose.Schema.Types.ObjectId,
  41. ref: 'eventModel'
  42. }]
  43. });
  44. userSchema.plugin(mongooseUniqueValidator);
  45. module.exports = mongoose.model('userModel', userSchema);