commonroutesServer/models/travelModel.js
models/travelModel.jsRaw
1var mongoose = require('mongoose'),
2 Schema = mongoose.Schema;
3
4
5var travelSchema = new Schema({
6 title: { type: String },
7 description: { type: String },
8 owner: { type: String },
9 from: { type: String },
10 to: { type: String },
11 date: { type: Date },
12 periodic: { type: Boolean },
13 generateddate: { type: Date },
14 seats: { type: Number },
15 package: { type: Boolean },
16 icon: { type: String },
17 phone: { type: Number },
18 telegram: { type: String },
19 collectivized: { type: Boolean },
20 modality: { type: String }, //if is an offering travel or asking for travel
21 joins: [{
22 joinedUserId: { type: String },
23 joinedUsername: { type: String },
24 acceptedUserId: { type: String },
25 joinedAvatar: { type: String }
26 }],
27 comments: [{
28 commentUserId: { type: String },
29 commentUsername: { type: String },
30 comment: { type: String },
31 commentAvatar: { type: String }
32 }]
33})
34module.exports = mongoose.model('travelModel', travelSchema);
35
36
37//modality can be: offering, asking, package