mirror of
https://github.com/arnaucube/commonroutesServer.git
synced 2026-02-28 05:26:42 +01:00
joins system done inside the travel model (with join and unjoin implemented
This commit is contained in:
@@ -17,7 +17,19 @@ var travelSchema = new Schema({
|
||||
phone: { type: Number },
|
||||
telegram: { type: String },
|
||||
collectivized: { type: Boolean },
|
||||
modality: { type: String } //if is an offering travel or asking for travel
|
||||
modality: { type: String }, //if is an offering travel or asking for travel
|
||||
joins: [{
|
||||
joinedUserId: { type: String },
|
||||
joinedUsername: { type: String },
|
||||
acceptedUserId: { type: String },
|
||||
joinedAvatar: { type: String }
|
||||
}],
|
||||
comments: [{
|
||||
commentUserId: { type: String },
|
||||
commentUsername: { type: String },
|
||||
comment: { type: String },
|
||||
commentAvatar: { type: String }
|
||||
}]
|
||||
})
|
||||
module.exports = mongoose.model('travelModel', travelSchema);
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
var mongoose = require('mongoose'),
|
||||
Schema = mongoose.Schema;
|
||||
|
||||
var mongooseUniqueValidator = require('mongoose-unique-validator');
|
||||
|
||||
|
||||
var userSchema = new Schema({
|
||||
username: { type: String },
|
||||
username: { type: String, unique: true },
|
||||
password: { type: String },
|
||||
description: { type: String },
|
||||
avatar: { type: String },
|
||||
@@ -16,4 +18,6 @@ var userSchema = new Schema({
|
||||
comment: { type: String }
|
||||
}]
|
||||
})
|
||||
|
||||
userSchema.plugin(mongooseUniqueValidator);
|
||||
module.exports = mongoose.model('userModel', userSchema);
|
||||
|
||||
Reference in New Issue
Block a user