forked from arthurkao/angular-drywall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAccount.js
44 lines (43 loc) · 1.5 KB
/
Account.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
42
43
44
'use strict';
exports = module.exports = function(app, mongoose) {
var accountSchema = new mongoose.Schema({
user: {
id: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
name: { type: String, default: '' }
},
isVerified: { type: String, default: '' },
verificationToken: { type: String, default: '' },
name: {
first: { type: String, default: '' },
middle: { type: String, default: '' },
last: { type: String, default: '' },
full: { type: String, default: '' }
},
company: { type: String, default: '' },
phone: { type: String, default: '' },
zip: { type: String, default: '' },
status: {
id: { type: String, ref: 'Status' },
name: { type: String, default: '' },
userCreated: {
id: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
name: { type: String, default: '' },
time: { type: Date, default: Date.now }
}
},
statusLog: [mongoose.modelSchemas.StatusLog],
notes: [mongoose.modelSchemas.Note],
userCreated: {
id: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
name: { type: String, default: '' },
time: { type: Date, default: Date.now }
},
search: [String]
});
accountSchema.plugin(require('./plugins/pagedFind'));
accountSchema.index({ user: 1 });
accountSchema.index({ 'status.id': 1 });
accountSchema.index({ search: 1 });
accountSchema.set('autoIndex', (app.get('env') === 'development'));
app.db.model('Account', accountSchema);
};