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.

survey.answer.schema.js 1007B

12345678910111213141516171819202122232425262728293031
  1. import Joi from 'joi'
  2. /**
  3. * answers schema object
  4. */
  5. const answersSchema = {
  6. type: 'object',
  7. properties: Joi.object().keys({
  8. name: Joi.string().required(),
  9. email: Joi.string().email({ minDomainSegments: 2, tlds: false }),
  10. // TODO: Refine password regex to have more secure requirements
  11. password: Joi.string().min(10).max(30).pattern(new RegExp('[a-zA-Z0-9]+')),
  12. // TODO: Change if going international (only works in usa)
  13. zipcode: Joi.string().min(5).max(5).pattern(new RegExp('^[0-9]{5}$')),
  14. seeking: Joi.string(),
  15. urgency: Joi.string(),
  16. presence: Joi.string(),
  17. duration: Joi.string(),
  18. pronouns: Joi.string(),
  19. language: Joi.string(),
  20. image: Joi.any(),
  21. distance: Joi.string(),
  22. blurb: Joi.string(),
  23. aspects: Joi.array().items(Joi.number().allow(null))
  24. }),
  25. validate(instance) {
  26. return this.properties.validate(instance)
  27. },
  28. }
  29. export { answersSchema }