Repository navigation
Expand file tree
/
Copy pathuser.js
More file actions
68 lines (66 loc) · 1.4 KB
/
Copy pathuser.js
File metadata and controls
68 lines (66 loc) · 1.4 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const mongoose = require('mongoose');
const userSchema = new mongoose.Schema({
playerName: {
type: String,
required: true,
trim: true
},
email: {
type: String,
required: true,
unique: true,
lowercase: true
},
whatsapp: {
type: String,
required: true
},
game: {
type: String,
enum: ['freefire', 'bgmi', 'both'],
required: true
},
freefire: {
uid: String,
ign: String
},
bgmi: {
uid: String,
ign: String
},
tournaments: [{
tournamentId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Tournament'
},
joinedAt: {
type: Date,
default: Date.now
},
status: {
type: String,
enum: ['registered', 'confirmed', 'cancelled'],
default: 'registered'
}
}],
stats: {
tournamentsJoined: {
type: Number,
default: 0
},
wins: {
type: Number,
default: 0
},
rank: String
},
whatsappConsent: {
type: Boolean,
default: false
},
createdAt: {
type: Date,
default: Date.now
}
});
module.exports = mongoose.model('User', userSchema);