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.

49 lines
1.7 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. shortDescription: { type: String },
  21. description: { type: String },
  22. img: { type: String, default: "https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png" },
  23. contact: {
  24. twitter: { type: String },
  25. facebook: { type: String },
  26. telegram: { type: String },
  27. web: { type: String },
  28. phone: { type: Number }
  29. },
  30. location:{
  31. direction: { type: String },
  32. city: { type: String },
  33. district: { type: String },
  34. geo: {
  35. lat: {type: Number},
  36. long: {type: Number},
  37. name: { type: String}
  38. }
  39. },
  40. events: [{
  41. type: mongoose.Schema.Types.ObjectId,
  42. ref: 'eventModel'
  43. }]
  44. });
  45. userSchema.plugin(mongooseUniqueValidator);
  46. module.exports = mongoose.model('userModel', userSchema);