diff --git a/backend/models/bot-command.js b/backend/models/bot-command.js deleted file mode 100644 index 8521206ce..000000000 --- a/backend/models/bot-command.js +++ /dev/null @@ -1,20 +0,0 @@ -const mongoose = require("mongoose"); -const Schema = mongoose.Schema; - -const botCommandSchema = new Schema( - { - command: { type: String, required: true }, - arguments: [{ type: Schema.Types.Mixed }], - executedTimestamp: { type: Date }, - requestTimestamp: { type: Date }, - executed: { type: Boolean, default: false }, - status: { type: String }, - }, - { - timestamps: true, - } -); - -const BotCommand = mongoose.model("BotCommand", botCommandSchema); - -module.exports = { BotCommand }; diff --git a/backend/models/leaderboard.js b/backend/models/leaderboard.js deleted file mode 100644 index 5c4694bef..000000000 --- a/backend/models/leaderboard.js +++ /dev/null @@ -1,32 +0,0 @@ -const mongoose = require("mongoose"); -const Schema = mongoose.Schema; - -const leaderboardEntrySchema = new Schema({ - name: { type: String }, - wpm: { type: Number }, - raw: { type: Number }, - acc: { type: Number }, - consistency: { type: {} }, //can be null - mode: { type: String }, //not sure why mode and mode2 are needed - mode2: { type: Number }, - timestamp: { type: Date }, - hidden: { type: Boolean }, -}); - -const leaderboardSchema = new Schema( - { - resetTime: { type: Date }, //or Number, only on daily lb - size: { type: Number, required: true }, - board: [{ type: leaderboardEntrySchema }], //contents of leaderbaord - 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 - }, - { - timestamps: true, - } -); - -const Leaderboard = mongoose.model("Leaderboard", leaderboardSchema); - -module.exports = { Leaderboard }; diff --git a/backend/models/stats.js b/backend/models/stats.js deleted file mode 100644 index 93b771a29..000000000 --- a/backend/models/stats.js +++ /dev/null @@ -1,17 +0,0 @@ -const mongoose = require("mongoose"); -const Schema = mongoose.Schema; - -const statsSchema = new Schema( - { - completedTests: { type: Number, default: 0 }, - startedTests: { type: Number, default: 0 }, - timeTyping: { type: Number, default: 0 }, - }, - { - timestamps: true, - } -); - -const Stats = mongoose.model("Stats", statsSchema); - -module.exports = { Stats }; diff --git a/backend/models/subschemas/config.js b/backend/models/subschemas/config.js deleted file mode 100644 index c22b1e9ac..000000000 --- a/backend/models/subschemas/config.js +++ /dev/null @@ -1,78 +0,0 @@ -const mongoose = require("mongoose"); -const Schema = mongoose.Schema; - -const configSchema = new Schema({ - theme: { type: String }, - customTheme: { type: Boolean }, - customThemeColors: [{ type: String }], - favThemes: [{ type: String }], - showKeyTips: { type: Boolean }, - showLiveWpm: { type: Boolean }, - showTimerProgress: { type: Boolean }, - smoothCaret: { type: Boolean }, - quickTab: { type: Boolean }, - punctuation: { type: Boolean }, - numbers: { type: Boolean }, - words: { type: Number }, - time: { type: Number }, - mode: { type: String }, - quoteLength: [{ type: Number }], - language: { type: String }, - fontSize: { type: Number }, - freedomMode: { type: Boolean }, - difficulty: { type: String }, - blindMode: { type: Boolean }, - quickEnd: { type: Boolean }, - caretStyle: { type: String }, - paceCaretStyle: { type: String }, - flipTestColors: { type: Boolean }, - capsLockBackspace: { type: Boolean }, - layout: { type: String }, - confidenceMode: { type: String }, - indicateTypos: { type: Boolean }, - timerStyle: { type: String }, - colorfulMode: { type: Boolean }, - randomTheme: { type: String }, //feels like this should be a boolean - timerColor: { type: String }, - timerOpacity: { type: String }, //maybe should be a number - stopOnError: { type: String }, - showAllLines: { type: Boolean }, - keymapMode: { type: String }, - keymapStyle: { type: String }, - keymapLegendStyle: { type: String }, - keymapLayout: { type: String }, - fontFamily: { type: String }, - smoothLineScroll: { type: Boolean }, - alwaysShowDecimalPlaces: { type: Boolean }, - alwaysShowWordsHistory: { type: Boolean }, - singleListCommandLine: { type: String }, - playSoundOnError: { type: Boolean }, - playSoundOnClick: { type: String }, - startGraphsAtZero: { type: Boolean }, - swapEscAndTab: { type: Boolean }, - showOutOfFocusWarning: { type: Boolean }, - paceCaret: { type: String }, - paceCaretCustomSpeed: { type: Number }, - pageWidth: { type: String }, - chartAccuracy: { type: Boolean }, - chartStyle: { type: String }, - minWpm: { type: String }, - minWpmCustomSpeed: { type: Number }, - highlightMode: { type: String }, - alwaysShowCPM: { type: Boolean }, - enableAds: { type: String }, - hideExtraLetters: { type: Boolean }, - strictSpace: { type: Boolean }, - minAcc: { type: String }, - minAccCustom: { type: Number }, - showLiveAcc: { type: Boolean }, - monkey: { type: Boolean }, - repeatQuotes: { type: String }, - oppositeShiftMode: { type: String }, - customBackground: { type: String }, - customBackgroundSize: { type: String }, - customBackgroundFilter: [{ type: Number }], - customLayoutfluid: { type: String }, -}); - -module.exports = { configSchema }; diff --git a/backend/models/subschemas/preset.js b/backend/models/subschemas/preset.js deleted file mode 100644 index 303ec8cf3..000000000 --- a/backend/models/subschemas/preset.js +++ /dev/null @@ -1,10 +0,0 @@ -const mongoose = require("mongoose"); -const Schema = mongoose.Schema; -const { configSchema } = require("./config"); - -const presetSchema = new Schema({ - name: { type: String, required: true }, - config: { type: configSchema }, //not sure if preset config always follows config schema -}); - -module.exports = { presetSchema }; diff --git a/backend/models/subschemas/result.js b/backend/models/subschemas/result.js deleted file mode 100644 index b27ade83f..000000000 --- a/backend/models/subschemas/result.js +++ /dev/null @@ -1,38 +0,0 @@ -const mongoose = require("mongoose"); -const Schema = mongoose.Schema; - -const resultSchema = new Schema({ - wpm: { type: Number, required: true }, - rawWpm: { type: Number, required: true }, - correctChars: { type: Number, required: true }, - incorrectChars: { type: Number, required: true }, - allChars: { type: Number, required: true }, - acc: { type: Number, required: true }, - mode: { type: String, required: true }, //is this always string type? - mode2: { type: String, required: true }, //is this always number type? not always - quoteLength: { type: Number, required: false }, - timestamp: { type: Number, required: true }, //can this be removed if timestamps are added to mongoose - language: { type: String, default: "english" }, - restartCount: { type: Number, required: true }, - incompleteTestSeconds: { type: Number, required: true }, - testDuration: { type: Number, required: true }, - afkDuration: { type: Number, required: true }, - theme: { type: String, required: true }, - tags: [{ type: String }], //the id of each tag - keySpacing: { type: String, default: "removed" }, //not sure what this or keyDuration is - keyDuration: { type: String, default: "removed" }, - consistency: { type: Number, required: true }, - keyConsistency: { type: Number, required: true }, - chartData: { - //should chartData have it's own schema? - wpm: [{ type: Number }], - raw: [{ type: Number }], - err: [{ type: Number }], - }, - customText: { type: Schema.Types.Mixed }, - keySpacingStats: { type: Schema.Types.Mixed }, //not sure that this needs to exist, it's set as null in all of mine - name: { type: String, required: true }, //name of the user who took the test //should probably be typistName/username or something - isPb: { type: Boolean, default: false }, -}); - -module.exports = { resultSchema }; diff --git a/backend/models/subschemas/tag.js b/backend/models/subschemas/tag.js deleted file mode 100644 index a0af7766f..000000000 --- a/backend/models/subschemas/tag.js +++ /dev/null @@ -1,9 +0,0 @@ -const mongoose = require("mongoose"); -const Schema = mongoose.Schema; - -const tagSchema = new Schema({ - name: { type: String, required: true }, - personalBests: { type: Schema.Types.Mixed }, -}); - -module.exports = { tagSchema }; diff --git a/backend/models/user.js b/backend/models/user.js deleted file mode 100644 index 811b53cd3..000000000 --- a/backend/models/user.js +++ /dev/null @@ -1,62 +0,0 @@ -const mongoose = require("mongoose"); -const Schema = mongoose.Schema; - -const { configSchema } = require("./subschemas/config"); -const { resultSchema } = require("./subschemas/result"); -const { tagSchema } = require("./subschemas/tag"); -const { presetSchema } = require("./subschemas/preset"); - -const userSchema = new Schema( - { - _id: { type: String }, - results: [{ type: resultSchema, default: {} }], - personalBests: { - custom: { type: Schema.Types.Mixed, default: {} }, - time: { type: Schema.Types.Mixed, default: {} }, - words: { type: Schema.Types.Mixed, default: {} }, - zen: { type: Schema.Types.Mixed, default: {} }, - }, - name: { type: String, required: true }, - uid: { type: String, required: true }, - discordId: { type: String }, - presets: [{ type: presetSchema, default: {} }], - tags: [{ type: tagSchema, default: {} }], - favouriteThemes: [], - refactored: { type: Boolean, default: true }, - banned: { type: Boolean, default: false }, - verified: { type: Boolean, default: false }, //Verified is actually whether or not discord account is connected - emailVerified: { type: Boolean, default: false }, - lbMemory: { - time15: { - global: { type: Number, default: -1 }, - daily: { type: Number, default: -1 }, - }, - time60: { - global: { type: Number, default: -1 }, - daily: { type: Number, default: -1 }, - }, - }, - globalStats: { - time: { type: Number, default: 0 }, - started: { type: Number, default: 0 }, //number of started tests - completed: { type: Number, default: 0 }, - }, - email: { type: String }, - config: { type: configSchema, default: {} }, - bananas: { - t60bananas: { type: Number, default: 0 }, - }, - dailyLbWins: { - time15: { type: Number }, - time60: { type: Number }, - }, - }, - { - timestamps: true, - minimize: false, //allows empty objects to be saved to mongodb - } -); - -const User = mongoose.model("User", userSchema); - -module.exports = { User };