diff --git a/backend/src/api/controllers/dev.ts b/backend/src/api/controllers/dev.ts index a81cc5aa16..d6c8295bf2 100644 --- a/backend/src/api/controllers/dev.ts +++ b/backend/src/api/controllers/dev.ts @@ -199,6 +199,9 @@ async function updateUser(uid: string): Promise { words: {}, zen: {}, quote: {}, + easy: {}, + medium: {}, + onerandom: {}, }; const modes = stats.map((it) => it["_id"]); for (const mode of modes) { diff --git a/backend/src/api/controllers/user.ts b/backend/src/api/controllers/user.ts index 6915c093f2..90716d7756 100644 --- a/backend/src/api/controllers/user.ts +++ b/backend/src/api/controllers/user.ts @@ -458,6 +458,9 @@ export async function getUser( quote: {}, zen: {}, custom: {}, + easy: {}, + medium: {}, + onerandom: {}, }; const agentLog = buildAgentLog(req); diff --git a/backend/src/api/routes/leaderboards.ts b/backend/src/api/routes/leaderboards.ts index 9b2705e3ae..37b4de6cac 100644 --- a/backend/src/api/routes/leaderboards.ts +++ b/backend/src/api/routes/leaderboards.ts @@ -16,7 +16,16 @@ const BASE_LEADERBOARD_VALIDATION_SCHEMA = { .required(), mode: joi .string() - .valid("time", "words", "quote", "zen", "custom") + .valid( + "time", + "words", + "quote", + "zen", + "custom", + "easy", + "medium", + "onerandom" + ) .required(), mode2: joi .string() diff --git a/backend/src/api/routes/public.ts b/backend/src/api/routes/public.ts index 86491c6b34..bdbe47e380 100644 --- a/backend/src/api/routes/public.ts +++ b/backend/src/api/routes/public.ts @@ -13,7 +13,16 @@ const GET_MODE_STATS_VALIDATION_SCHEMA = { .required(), mode: joi .string() - .valid("time", "words", "quote", "zen", "custom") + .valid( + "time", + "words", + "quote", + "zen", + "custom", + "easy", + "medium", + "onerandom" + ) .required(), mode2: joi .string() diff --git a/backend/src/api/routes/users.ts b/backend/src/api/routes/users.ts index 79e5d0658b..1876ed1627 100644 --- a/backend/src/api/routes/users.ts +++ b/backend/src/api/routes/users.ts @@ -177,7 +177,16 @@ router.patch( body: { mode: joi .string() - .valid("time", "words", "quote", "zen", "custom") + .valid( + "time", + "words", + "quote", + "zen", + "custom", + "easy", + "medium", + "onerandom" + ) .required(), mode2: joi .string() @@ -434,7 +443,16 @@ router.get( query: { mode: joi .string() - .valid("time", "words", "quote", "zen", "custom") + .valid( + "time", + "words", + "quote", + "zen", + "custom", + "easy", + "medium", + "onerandom" + ) .required(), mode2: joi.string().regex(/^(\d)+|custom|zen/), }, diff --git a/backend/src/api/schemas/config-schema.ts b/backend/src/api/schemas/config-schema.ts index baebe8b715..5ad15700b9 100644 --- a/backend/src/api/schemas/config-schema.ts +++ b/backend/src/api/schemas/config-schema.ts @@ -30,7 +30,18 @@ const CONFIG_SCHEMA = joi.object({ numbers: joi.boolean(), words: joi.number().min(0), time: joi.number().min(0), - mode: joi.string().valid("time", "words", "quote", "zen", "custom"), + mode: joi + .string() + .valid( + "time", + "words", + "quote", + "zen", + "custom", + "easy", + "medium", + "onerandom" + ), quoteLength: joi.array().items(joi.number()), language: joi .string() diff --git a/backend/src/api/schemas/filter-schema.ts b/backend/src/api/schemas/filter-schema.ts index 793407b242..5483ca64e9 100644 --- a/backend/src/api/schemas/filter-schema.ts +++ b/backend/src/api/schemas/filter-schema.ts @@ -30,6 +30,9 @@ const FILTER_SCHEMA = { quote: joi.bool().required(), zen: joi.bool().required(), custom: joi.bool().required(), + easy: joi.bool().required(), + medium: joi.bool().required(), + onerandom: joi.bool().required(), }) .required(), words: joi diff --git a/backend/src/api/schemas/result-schema.ts b/backend/src/api/schemas/result-schema.ts index 233469922d..b5b783cbda 100644 --- a/backend/src/api/schemas/result-schema.ts +++ b/backend/src/api/schemas/result-schema.ts @@ -71,7 +71,16 @@ const RESULT_SCHEMA = joi lazyMode: joi.boolean().required(), mode: joi .string() - .valid("time", "words", "quote", "zen", "custom") + .valid( + "time", + "words", + "quote", + "zen", + "custom", + "easy", + "medium", + "onerandom" + ) .required(), mode2: joi .string() diff --git a/backend/src/dal/user.ts b/backend/src/dal/user.ts index b2faa47483..ce2cd0e1ef 100644 --- a/backend/src/dal/user.ts +++ b/backend/src/dal/user.ts @@ -55,6 +55,9 @@ export async function addUser( quote: {}, zen: {}, custom: {}, + easy: {}, + medium: {}, + onerandom: {}, }, testActivity: {}, }; @@ -85,6 +88,9 @@ export async function resetUser(uid: string): Promise { quote: {}, zen: {}, custom: {}, + easy: {}, + medium: {}, + onerandom: {}, }, lbPersonalBests: { time: {}, @@ -170,6 +176,9 @@ export async function clearPb(uid: string): Promise { quote: {}, zen: {}, custom: {}, + easy: {}, + medium: {}, + onerandom: {}, }, lbPersonalBests: { time: {}, @@ -344,6 +353,9 @@ export async function addTag( quote: {}, zen: {}, custom: {}, + easy: {}, + medium: {}, + onerandom: {}, }, }; @@ -403,6 +415,9 @@ export async function removeTagPb(uid: string, _id: string): Promise { quote: {}, zen: {}, custom: {}, + easy: {}, + medium: {}, + onerandom: {}, }, }, }, @@ -447,6 +462,9 @@ export async function checkIfPb( quote: {}, words: {}, zen: {}, + easy: {}, + medium: {}, + onerandom: {}, }; user.lbPersonalBests ??= { time: {}, @@ -505,6 +523,9 @@ export async function checkIfTagPb( quote: {}, zen: {}, custom: {}, + easy: {}, + medium: {}, + onerandom: {}, }; const tagpb = checkAndUpdatePb(tag.personalBests, undefined, result); @@ -531,6 +552,9 @@ export async function resetPb(uid: string): Promise { quote: {}, zen: {}, custom: {}, + easy: {}, + medium: {}, + onerandom: {}, }, }, }, diff --git a/frontend/package.json b/frontend/package.json index 9b853d7105..39044fa12b 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -31,8 +31,8 @@ ], "devDependencies": { "@fortawesome/fontawesome-free": "5.15.4", - "@monkeytype/shared-types": "*", "@monkeytype/eslint-config": "*", + "@monkeytype/shared-types": "*", "@monkeytype/typescript-config": "*", "@types/canvas-confetti": "1.4.3", "@types/chartjs-plugin-trendline": "1.0.1", @@ -97,5 +97,8 @@ "madge": { "@typescript-eslint/typescript-estree": "7.1.0" } + }, + "optionalDependencies": { + "@rollup/rollup-linux-x64-gnu": "4.19.1" } } diff --git a/frontend/src/html/pages/account.html b/frontend/src/html/pages/account.html index 6e3f63aade..27ce4b6b8c 100644 --- a/frontend/src/html/pages/account.html +++ b/frontend/src/html/pages/account.html @@ -437,6 +437,9 @@ + + +
diff --git a/frontend/src/html/pages/test.html b/frontend/src/html/pages/test.html index dae4a42449..0779037e8c 100644 --- a/frontend/src/html/pages/test.html +++ b/frontend/src/html/pages/test.html @@ -35,6 +35,18 @@ custom + + +
diff --git a/frontend/src/html/popups.html b/frontend/src/html/popups.html index 7cfd5f6e06..c3d0cfea23 100644 --- a/frontend/src/html/popups.html +++ b/frontend/src/html/popups.html @@ -141,7 +141,9 @@