2021-05-27 02:55:42 +08:00
|
|
|
const mongoose = require("mongoose");
|
|
|
|
const Schema = mongoose.Schema;
|
|
|
|
|
|
|
|
const leaderboardEntrySchema = new Schema({
|
2021-05-27 07:18:17 +08:00
|
|
|
name: { type: String },
|
|
|
|
wpm: { type: Number },
|
|
|
|
raw: { type: Number },
|
|
|
|
acc: { type: Number },
|
|
|
|
consistency: { type: Number }, //can be null
|
|
|
|
mode: { type: String }, //not sure why mode and mode2 are needed
|
|
|
|
mode2: { type: Number },
|
|
|
|
timestamp: { type: Date },
|
|
|
|
hidden: { type: Boolean },
|
2021-05-27 02:55:42 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
const leaderboardSchema = new Schema(
|
|
|
|
{
|
2021-05-27 07:18:17 +08:00
|
|
|
resetTime: { type: Date }, //or Number, only on daily lb
|
2021-06-03 10:03:37 +08:00
|
|
|
size: { type: Number, required: true },
|
2021-05-27 02:55:42 +08:00
|
|
|
board: [{ type: leaderboardEntrySchema }], //contents of leaderbaord
|
2021-06-03 10:03:37 +08:00
|
|
|
mode: { type: String, required: true }, //only equal to 'time' for now
|
|
|
|
mode2: { type: Number, required: true }, //only equal to 15 and 60 for now
|
|
|
|
type: { type: String, required: true }, //global or local
|
2021-05-27 02:55:42 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
timestamps: true,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
const Leaderboard = mongoose.model("Leaderboard", leaderboardSchema);
|
|
|
|
|
|
|
|
module.exports = { Leaderboard };
|