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    notifications: [{
27      type: { type: String },//fav, comment, join
28      otherusername: { type: String },
29      description: { type: String },
30      date: { type: Date },
31      link: { type: String }
32    }]
33})
34
35userSchema.plugin(mongooseUniqueValidator);
36module.exports = mongoose.model('userModel', userSchema);