mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
18 lines
546 B
JavaScript
18 lines
546 B
JavaScript
import { body } from 'express-validator'
|
|
import { noError } from '../../middleware/validator.js'
|
|
|
|
const checkCommand = () => body('command').isString().notEmpty().trim()
|
|
const checkPwd = () => body('pwd').isString().notEmpty().trim()
|
|
const checkOutput = () => body('output').trim().optional()
|
|
const checkError = () => body('error').trim().optional()
|
|
const checkParams = () => body('params').isObject().optional()
|
|
|
|
export const newCommandValidator = [
|
|
checkCommand(),
|
|
checkPwd(),
|
|
checkOutput(),
|
|
checkError(),
|
|
checkParams(),
|
|
noError,
|
|
]
|