1
0
Fork 0
peertube/server/middlewares/validators/user-history.ts

26 lines
751 B
TypeScript
Raw Normal View History

import * as express from 'express'
2019-07-25 10:23:44 -04:00
import { body } from 'express-validator'
import { logger } from '../../helpers/logger'
import { areValidationErrors } from './utils'
2018-12-26 04:36:24 -05:00
import { isDateValid } from '../../helpers/custom-validators/misc'
const userHistoryRemoveValidator = [
body('beforeDate')
.optional()
.custom(isDateValid).withMessage('Should have a valid before date'),
(req: express.Request, res: express.Response, next: express.NextFunction) => {
logger.debug('Checking userHistoryRemoveValidator parameters', { parameters: req.body })
if (areValidationErrors(req, res)) return
return next()
}
]
// ---------------------------------------------------------------------------
export {
userHistoryRemoveValidator
}