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.

45 lines
1.2 KiB

7 years ago
  1. var mongoose = require('mongoose'),
  2. Schema = mongoose.Schema;
  3. var travelSchema = new Schema({
  4. title: { type: String, required: true },
  5. description: { type: String },
  6. user: {
  7. type: mongoose.Schema.Types.ObjectId,
  8. ref: 'userModel'
  9. },
  10. from: {
  11. lat: {type: Number},
  12. long: {type: Number},
  13. name: { type: String, required: true }
  14. },
  15. to: {
  16. lat: {type: Number},
  17. long: {type: Number},
  18. name: { type: String, required: true }
  19. },
  20. date: { type: Date, required: true },
  21. periodic: { type: Boolean },
  22. generateddate: { type: Date },
  23. seats: { type: Number },
  24. package: { type: Boolean },
  25. collectivized: { type: Boolean },
  26. type: { type: String }, //if is an offering travel or asking for travel
  27. joins: [{
  28. type: mongoose.Schema.Types.ObjectId,
  29. ref: 'userModel'
  30. }],
  31. joinPetitions: [{
  32. type: mongoose.Schema.Types.ObjectId,
  33. ref: 'userModel'
  34. }],
  35. comments: [{
  36. type: mongoose.Schema.Types.ObjectId,
  37. ref: 'commentModel'
  38. }]
  39. })
  40. module.exports = mongoose.model('travelModel', travelSchema);
  41. //modality can be: offering, asking, package