arnaucube
arnaucube/commonroutesServerPublic Self-hosted repository
commonroutesServer/models/userModel.js
models/userModel.jsRaw
 1var mongoose = require('mongoose'),
 2    Schema   = mongoose.Schema;
 3
 4var mongooseUniqueValidator = require('mongoose-unique-validator');
 5
 6
 7var userSchema = new Schema({
 8    username: { type: String, unique: true },
 9    password: { type: String },
10    token: { type: String },
11    description:   { type: String },
12    avatar:   { type: String },
13    mail:   { type: String },
14    phone: { type: String },
15    telegram: { type: String },
16    valorations: [{
17      username: { type: String },
18      value: { type: Number },
19      comment: { type: String }
20    }],
21    favs: [{
22      username: { type: String },
23      userId: { type: String },
24      avatar: { type: String }
25    }]
26})
27
28userSchema.plugin(mongooseUniqueValidator);
29module.exports = mongoose.model('userModel', userSchema);