You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

responses.js 763B

12345678910111213141516171819202122232425262728293031
  1. const Joi = require('joi')
  2. /**
  3. * Responses
  4. * A response records how a profile answers
  5. * a specific question (response-key).
  6. */
  7. // validator is used to validate route input/output
  8. const validator = Joi.object({
  9. response_key_id: Joi.number(),
  10. response_id: Joi.number(),
  11. profile_id: Joi.number(),
  12. val: Joi.string().allow(null, ''),
  13. }).label('response__single_validator')
  14. const list = Joi.array().items(validator).label('response__list_validator')
  15. // single is used to define database models
  16. const single = Joi.object({
  17. response_key_id: Joi.number(),
  18. response_id: Joi.number(),
  19. profile_id: Joi.number(),
  20. val: Joi.string().allow(null, ''),
  21. }).label('response__single')
  22. module.exports = {
  23. single,
  24. validator,
  25. list,
  26. }