Fix(schema): Enforce type Number for "challengeType" (#17409)

* fix(schema): Enforce number types

* fix(seed): String challengeType -> Number challengeType
This commit is contained in:
Stuart Taylor
2018-06-03 20:33:44 +01:00
committed by Quincy Larson
parent 0234bb82c0
commit bb18a2ed36
2 changed files with 6 additions and 6 deletions

View File

@ -3633,7 +3633,7 @@
} }
], ],
"id": "5a7dad05be01840e1778a0d1", "id": "5a7dad05be01840e1778a0d1",
"challengeType": "3", "challengeType": 3,
"releasedOn": "May 31, 2018", "releasedOn": "May 31, 2018",
"files": { "files": {
"indexjs": { "indexjs": {
@ -4404,7 +4404,7 @@
} }
], ],
"id": "5a23c84252665b21eecc7e76", "id": "5a23c84252665b21eecc7e76",
"challengeType": "3", "challengeType": 3,
"releasedOn": "June 1, 2018", "releasedOn": "June 1, 2018",
"files": { "files": {
"indexjs": { "indexjs": {

View File

@ -4,7 +4,7 @@ Joi.objectId = require('joi-objectid')(Joi);
const schema = Joi.object().keys({ const schema = Joi.object().keys({
block: Joi.string(), block: Joi.string(),
blockId: Joi.objectId(), blockId: Joi.objectId(),
challengeType: Joi.number().min(0).max(9).required(), challengeType: Joi.number().integer().min(0).max(9).required().options({ convert: false }),
checksum: Joi.number(), checksum: Joi.number(),
dashedName: Joi.string(), dashedName: Joi.string(),
description: Joi.array().items( description: Joi.array().items(
@ -40,7 +40,7 @@ const schema = Joi.object().keys({
isPrivate: Joi.bool(), isPrivate: Joi.bool(),
isRequired: Joi.bool(), isRequired: Joi.bool(),
name: Joi.string(), name: Joi.string(),
order: Joi.number(), order: Joi.number().options({ convert: false }),
required: Joi.array().items( required: Joi.array().items(
Joi.object().keys({ Joi.object().keys({
link: Joi.string(), link: Joi.string(),
@ -53,8 +53,8 @@ const schema = Joi.object().keys({
Joi.string().optional() Joi.string().optional()
), ),
superBlock: Joi.string(), superBlock: Joi.string(),
superOrder: Joi.number(), superOrder: Joi.number().options({ convert: false }),
suborder: Joi.number(), suborder: Joi.number().options({ convert: false }),
tests: Joi.array().items( tests: Joi.array().items(
// public challenges // public challenges
Joi.object().keys({ Joi.object().keys({