1 import express from 'express'
2 import { body, param, query } from 'express-validator'
3 import { exists, isDateValid, isIdValid } from '../../helpers/custom-validators/misc'
4 import { logger } from '../../helpers/logger'
5 import { areValidationErrors } from './shared'
7 const userHistoryListValidator = [
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 userHistoryRemoveAllValidator = [
24 .custom(isDateValid).withMessage('Should have a before date that conforms to ISO 8601'),
26 (req: express.Request, res: express.Response, next: express.NextFunction) => {
27 logger.debug('Checking userHistoryRemoveAllValidator parameters', { parameters: req.body })
29 if (areValidationErrors(req, res)) return
35 const userHistoryRemoveElementValidator = [
39 (req: express.Request, res: express.Response, next: express.NextFunction) => {
40 logger.debug('Checking userHistoryRemoveElementValidator parameters', { parameters: req.params })
42 if (areValidationErrors(req, res)) return
48 // ---------------------------------------------------------------------------
51 userHistoryListValidator,
52 userHistoryRemoveElementValidator,
53 userHistoryRemoveAllValidator