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.
*/
const validator = require('../utils/person_validator');
const validator = require('../utils/validators/person_validator');
const jwtUtils = require('../utils/middleware_utils');
const bcrypt = require('bcrypt');
const crypto = require('crypto');
@ -33,7 +33,9 @@ async function registerPerson(req, res) {
const errors = validator.validationResult(req);
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?

View File

@ -14,7 +14,7 @@
const {
check,
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 = [
check('display_name').trim().notEmpty().escape().isLength({