-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.js
41 lines (39 loc) · 788 Bytes
/
user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var mongoose = require('mongoose');
var Team = require('./team');
module.exports = new mongoose.Schema({
profile: {
username: {
type: String,
required: true,
lowercase: true
},
picture: {
type: String,
required: false
//match: /^http:\/\//i
},
email: {
type: String,
required: true
//match: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/
},
passwd: {
type: String,
required: false
}
},
data: {
oauth: {
type: String,
required: false
},
teams: [{
team: {
type: mongoose.Schema.Types.ObjectId,
ref: Team
}
}]
}
});
module.exports.set('toObject', { virtuals: true });
module.exports.set('toJSON', { virtuals: true });