Guest User

Untitled

a guest
Aug 20th, 2019
65
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. validatePostSurveySchema(body) { const schema = Joi.object().keys({ title: Joi.string().required(), surveyContent: Joi.array().items([ { question: Joi.array().items([ { questionTitle: Joi.array().items(Joi.string()) } ]), options: Joi.array().items([ { option1: Joi.string().required(), option2: Joi.string().required(), option3: Joi.any(), option4: Joi.any() } ]) } ]) }); const { error } = Joi.validate(body, schema); if (error && error.details) { console.log(error); return { error }; } }
RAW Paste Data