core: fix validator

This commit is contained in:
undefined committed 2023-01-28 19:26:07 +08:00
1 parent bc43b2fd4e
commit caf6ce058f
5 files changed
+9 -6

No files matched your search

+2 -2
View File
@@ -629,7 +629,7 @@ export class ProblemEditHandler extends ProblemManageHandler {
@route('pid', Types.ProblemId)
@post('title', Types.Title)
@post('content', Types.Content)
@post('pid', Types.ProblemId, true)
@post('pid', Types.ProblemId, true, (i) => /^[a-zA-Z]+[a-zA-Z0-9]*$/i.test(i))
@post('hidden', Types.Boolean)
@post('tag', Types.Content, true, null, parseCategory)
@post('difficulty', Types.PositiveInt, (i) => +i <= 10, true)
@@ -965,7 +965,7 @@ export class ProblemCreateHandler extends Handler {
@post('title', Types.Title)
@post('content', Types.Content)
@post('pid', Types.ProblemId, true)
@post('pid', Types.ProblemId, true, (i) => /^[a-zA-Z]+[a-zA-Z0-9]*$/i.test(i))
@post('hidden', Types.Boolean)
@post('difficulty', Types.PositiveInt, (i) => +i <= 10, true)
@post('tag', Types.Content, true, null, parseCategory)