username type String trim true required true email type String unique

 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
{
username: {
type: String,
trim: true,
required: true
},
email: {
type: String,
unique: true,
lowercase: true,
trim: true
},
password: String,
role: {
type: String,
default: 'user',
enum: ['anon', 'user', 'admin', 'metrdotel', 'steward', 'cook']
},
isDeleted: Boolean,
tableCode: {
type: String,
default: null
},
currentTable: {
type: {
number: Number,
title: String
},
default: null
},
currentOrderId: {
type: mongoose.Schema.Types.ObjectId,
default: null,
ref: 'Order'
},
isSeedTable: {
type: Boolean,
default: false
}
}