Move all of the penalty options into their own object
This commit is contained in:
parent
fc7b14fddc
commit
853ffa9cbb
1 changed files with 25 additions and 5 deletions
|
|
@ -1,14 +1,34 @@
|
||||||
import Joi from "joi";
|
import Joi from "joi";
|
||||||
|
|
||||||
|
const render = true;
|
||||||
|
|
||||||
|
export const penaltyOptionsSchema = Joi.object({
|
||||||
|
guess: Joi
|
||||||
|
.number()
|
||||||
|
.integer()
|
||||||
|
.min(0)
|
||||||
|
.max(Joi.ref(`...max_incorrect`, { render }))
|
||||||
|
.default(1),
|
||||||
|
solve: Joi
|
||||||
|
.number()
|
||||||
|
.integer()
|
||||||
|
.min(0)
|
||||||
|
.max(Joi.ref(`...max_incorrect`, { render }))
|
||||||
|
.default(1),
|
||||||
|
duplicate: Joi
|
||||||
|
.number()
|
||||||
|
.integer()
|
||||||
|
.min(0)
|
||||||
|
.max(Joi.ref(`...max_incorrect`, { render }))
|
||||||
|
.default(0),
|
||||||
|
})
|
||||||
|
.meta({ className: `penaltyOptions` })
|
||||||
|
.description(`The options for all of the penalties from actions`);
|
||||||
|
|
||||||
export const gameOptionsSchema = Joi.object({
|
export const gameOptionsSchema = Joi.object({
|
||||||
files: Joi.object().required().min(1).unknown(true),
|
files: Joi.object().required().min(1).unknown(true),
|
||||||
max_incorrect: Joi.number().min(1).default(6),
|
max_incorrect: Joi.number().min(1).default(6),
|
||||||
incorrect_solve_penalty: Joi
|
penalties: penaltyOptionsSchema.required(),
|
||||||
.number()
|
|
||||||
.min(0)
|
|
||||||
.max(Joi.ref(`max_incorrect`, { render: true }))
|
|
||||||
.default(1),
|
|
||||||
})
|
})
|
||||||
.meta({ className: `gameOptions` })
|
.meta({ className: `gameOptions` })
|
||||||
.description(`The game-specific options`);
|
.description(`The game-specific options`);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue