mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-08 13:11:19 +08:00
* Added `ResultFilters` to types Added customFilters field to user This field is an optional array of `ResultFilters` It will store a user's custom filters * Added Add and Remove functions for `ResultFilters` in user DAL Also added unit tests * Added Custom Filter configuration Can now enable/disable the custom filters feature Can also set a cap on the number of filters per user * Add and Remove functions for `ResultFilters` in user controller
This commit is contained in:
parent
9e0017bd43
commit
b55419dfc0
2 changed files with 11 additions and 2 deletions
|
|
@ -2,7 +2,16 @@ import joi from "joi";
|
|||
|
||||
const FILTER_SCHEMA = {
|
||||
_id: joi.string().required(),
|
||||
name: joi.string().required(),
|
||||
name: joi
|
||||
.string()
|
||||
.required()
|
||||
.regex(/^[0-9a-zA-Z_.-]+$/)
|
||||
.max(16)
|
||||
.messages({
|
||||
"string.pattern.base":
|
||||
"Filter name invalid. Name cannot contain special characters or more than 16 characters. Can include _ . and -",
|
||||
"string.max": "Filter name exceeds maximum of 16 characters",
|
||||
}),
|
||||
difficulty: joi
|
||||
.object({
|
||||
normal: joi.bool().required(),
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export const BASE_CONFIGURATION: MonkeyTypes.Configuration = {
|
|||
enabled: false,
|
||||
},
|
||||
customFilters: {
|
||||
enabled: true,
|
||||
enabled: false,
|
||||
maxFiltersPerUser: 0,
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue