2
1

user-history.ts 784 B

1234567891011121314151617181920212223242526
  1. import * as express from 'express'
  2. import 'express-validator'
  3. import { body } from 'express-validator/check'
  4. import { logger } from '../../helpers/logger'
  5. import { areValidationErrors } from './utils'
  6. import { isDateValid } from '../../helpers/custom-validators/misc'
  7. const userHistoryRemoveValidator = [
  8. body('beforeDate')
  9. .optional()
  10. .custom(isDateValid).withMessage('Should have a valid before date'),
  11. (req: express.Request, res: express.Response, next: express.NextFunction) => {
  12. logger.debug('Checking userHistoryRemoveValidator parameters', { parameters: req.body })
  13. if (areValidationErrors(req, res)) return
  14. return next()
  15. }
  16. ]
  17. // ---------------------------------------------------------------------------
  18. export {
  19. userHistoryRemoveValidator
  20. }