1 import * as express from 'express'
2 import { body, query } from 'express-validator'
3 import { logger } from '../../helpers/logger'
4 import { areValidationErrors } from './utils'
5 import { exists, isDateValid } from '../../helpers/custom-validators/misc'
7 const userHistoryListValidator = [
10 .custom(exists).withMessage('Should have a valid search'),
12 (req: express.Request, res: express.Response, next: express.NextFunction) => {
13 logger.debug('Checking userHistoryListValidator parameters', { parameters: req.query })
15 if (areValidationErrors(req, res)) return
21 const userHistoryRemoveValidator = [
24 .custom(isDateValid).withMessage('Should have a valid before date'),
26 (req: express.Request, res: express.Response, next: express.NextFunction) => {
27 logger.debug('Checking userHistoryRemoveValidator parameters', { parameters: req.body })
29 if (areValidationErrors(req, res)) return
35 // ---------------------------------------------------------------------------
38 userHistoryListValidator,
39 userHistoryRemoveValidator