import { body, query } from 'express-validator'
import { isNotEmptyIntArray, toBooleanOrNull } from '../../helpers/custom-validators/misc'
import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications'
-import { logger } from '../../helpers/logger'
import { areValidationErrors } from './shared'
const listUserNotificationsValidator = [
.isBoolean().withMessage('Should have a valid unread boolean'),
(req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking listUserNotificationsValidator parameters', { parameters: req.query })
-
if (areValidationErrors(req, res)) return
return next()
.custom(isUserNotificationSettingValid),
(req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking updateNotificationSettingsValidator parameters', { parameters: req.body })
-
if (areValidationErrors(req, res)) return
return next()
.custom(isNotEmptyIntArray).withMessage('Should have a valid array of notification ids'),
(req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking markAsReadUserNotificationsValidator parameters', { parameters: req.body })
-
if (areValidationErrors(req, res)) return
return next()