change validator location

This commit is contained in:
xfarrow 2024-03-06 16:02:22 +01:00
parent de8e091231
commit e8d52f1acb
2 changed files with 5 additions and 3 deletions

View File

@ -11,7 +11,7 @@
IN THE SOFTWARE. IN THE SOFTWARE.
*/ */
const validator = require('../utils/person_validator'); const validator = require('../utils/validators/person_validator');
const jwtUtils = require('../utils/middleware_utils'); const jwtUtils = require('../utils/middleware_utils');
const bcrypt = require('bcrypt'); const bcrypt = require('bcrypt');
const crypto = require('crypto'); const crypto = require('crypto');
@ -33,7 +33,9 @@ async function registerPerson(req, res) {
const errors = validator.validationResult(req); const errors = validator.validationResult(req);
if (!errors.isEmpty()) { if (!errors.isEmpty()) {
return res.status(400).json({ errors: errors.array() }); return res.status(400).json({
errors: errors.array()
});
} }
// Does this server allow users to register? // Does this server allow users to register?

View File

@ -14,7 +14,7 @@
const { const {
check, check,
validationResult validationResult
} = require("express-validator"); } = require("express-validator"); // This is the destructuring part. It specifies which properties of the imported object (express-validator) you want to extract.
const registerValidator = [ const registerValidator = [
check('display_name').trim().notEmpty().escape().isLength({ check('display_name').trim().notEmpty().escape().isLength({