-import * as express from 'express'
-import { param } from 'express-validator/check'
-import { isAccountNameValid, isAccountNameWithHostExist, isLocalAccountNameExist } from '../../helpers/custom-validators/accounts'
+import express from 'express'
+import { param } from 'express-validator'
+import { isAccountNameValid } from '../../helpers/custom-validators/accounts'
import { logger } from '../../helpers/logger'
-import { areValidationErrors } from './utils'
+import { areValidationErrors, doesAccountNameWithHostExist, doesLocalAccountNameExist } from './shared'
const localAccountValidator = [
param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'),
logger.debug('Checking localAccountValidator parameters', { parameters: req.params })
if (areValidationErrors(req, res)) return
- if (!await isLocalAccountNameExist(req.params.name, res)) return
+ if (!await doesLocalAccountNameExist(req.params.name, res)) return
return next()
}
logger.debug('Checking accountsNameWithHostGetValidator parameters', { parameters: req.params })
if (areValidationErrors(req, res)) return
- if (!await isAccountNameWithHostExist(req.params.accountName, res)) return
+ if (!await doesAccountNameWithHostExist(req.params.accountName, res)) return
return next()
}