-
-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathuser.js
40 lines (38 loc) · 811 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
const mongoose = require("mongoose")
const contestHistorySchema = new mongoose.Schema({
_id: String,
title: String,
startTime: Number,
rating: {
type: Number,
default:1500,
},
ranking:{
type:Number,
default: 0
},
})
const userSchema = new mongoose.Schema({
_id:{
type: String
},
attendedContestsCount:{
type: Number,
default: 0
},
rating:{
type: Number,
default: 1500
},
globalRanking:{
type: Number,
default:0
},
contestsHistory: [contestHistorySchema],
lastUpdated:{
type: Date,
default: Date.now,
},
})
exports.User = mongoose.model("User",userSchema)
exports.ContestHistory = mongoose.model("ContestHistory",contestHistorySchema)