mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-29 03:20:46 +08:00
Make quote actions not break with c++ language (#3925) o-x-e-y
* Make quote actions not break with c++ c++ currently obviously has `+` symbols which means stuff like quote ratings break because of the validation regex. I feel like changing `\w` straight to `.` would also be fine since languages and their names get approved manually, but this should work fine for now * fix silly mistake a `.regex()` got removed for whatever reason * Fix prettier bug * remove unnecessary spaces Co-authored-by: Rizwan Mustafa <rizwanmustafa0000@gmail.com>
This commit is contained in:
parent
33437d8fee
commit
6c9ee41444
1 changed files with 13 additions and 4 deletions
|
|
@ -41,7 +41,10 @@ router.post(
|
|||
body: {
|
||||
text: joi.string().min(60).required(),
|
||||
source: joi.string().required(),
|
||||
language: joi.string().regex(/^\w+$/).required(),
|
||||
language: joi
|
||||
.string()
|
||||
.regex(/^[\w+]+$/)
|
||||
.required(),
|
||||
captcha: joi.string().required(),
|
||||
},
|
||||
validationErrorMessage: "Please fill all the fields",
|
||||
|
|
@ -85,7 +88,10 @@ router.get(
|
|||
validateRequest({
|
||||
query: {
|
||||
quoteId: joi.string().regex(/^\d+$/).required(),
|
||||
language: joi.string().regex(/^\w+$/).required(),
|
||||
language: joi
|
||||
.string()
|
||||
.regex(/^[\w+]+$/)
|
||||
.required(),
|
||||
},
|
||||
}),
|
||||
asyncHandler(QuoteController.getRating)
|
||||
|
|
@ -99,7 +105,10 @@ router.post(
|
|||
body: {
|
||||
quoteId: joi.number().required(),
|
||||
rating: joi.number().min(1).max(5).required(),
|
||||
language: joi.string().regex(/^\w+$/).required(),
|
||||
language: joi
|
||||
.string()
|
||||
.regex(/^[\w+]+$/)
|
||||
.required(),
|
||||
},
|
||||
}),
|
||||
asyncHandler(QuoteController.submitRating)
|
||||
|
|
@ -122,7 +131,7 @@ router.post(
|
|||
validateRequest({
|
||||
body: {
|
||||
quoteId: withCustomMessages.regex(/\d+/).required(),
|
||||
quoteLanguage: withCustomMessages.regex(/^\w+$/).required(),
|
||||
quoteLanguage: withCustomMessages.regex(/^[\w+]+$/).required(),
|
||||
reason: joi
|
||||
.string()
|
||||
.valid(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue