Fix validator only works with strings
This commit is contained in:
@ -526,14 +526,12 @@ module.exports = function(app) {
|
|||||||
|
|
||||||
function completedChallenge(req, res, next) {
|
function completedChallenge(req, res, next) {
|
||||||
req.checkBody('id', 'id must be a ObjectId').isMongoId();
|
req.checkBody('id', 'id must be a ObjectId').isMongoId();
|
||||||
|
|
||||||
req.checkBody('name', 'name must be at least 3 characters')
|
req.checkBody('name', 'name must be at least 3 characters')
|
||||||
.isString()
|
.isString()
|
||||||
.isLength({ min: 3 });
|
.isLength({ min: 3 });
|
||||||
|
|
||||||
req.checkBody('challengeType', 'challengeType must be an integer')
|
req.checkBody('challengeType', 'challengeType must be an integer')
|
||||||
.isNumber()
|
.isNumber();
|
||||||
.isInt();
|
|
||||||
const type = accepts(req).type('html', 'json', 'text');
|
const type = accepts(req).type('html', 'json', 'text');
|
||||||
|
|
||||||
const errors = req.validationErrors(true);
|
const errors = req.validationErrors(true);
|
||||||
@ -598,8 +596,7 @@ module.exports = function(app) {
|
|||||||
.isString()
|
.isString()
|
||||||
.isLength({ min: 3 });
|
.isLength({ min: 3 });
|
||||||
req.checkBody('challengeType', 'must be a number')
|
req.checkBody('challengeType', 'must be a number')
|
||||||
.isNumber()
|
.isNumber();
|
||||||
.isInt();
|
|
||||||
req.checkBody('solution', 'solution must be a url').isURL();
|
req.checkBody('solution', 'solution must be a url').isURL();
|
||||||
|
|
||||||
const errors = req.validationErrors(true);
|
const errors = req.validationErrors(true);
|
||||||
|
Reference in New Issue
Block a user