Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

profile.schema.js 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /** @module entities/profileSchema */
  2. import Joi from 'joi'
  3. import { allModules, responseSchema } from '..'
  4. /**
  5. * profile schema object
  6. * uses the module system to use common fields
  7. * but sets fields with our validation types
  8. * @constructor
  9. */
  10. const profileSchema = {
  11. type: 'object',
  12. properties: Joi.object().keys({
  13. /** _baseRecord fields */
  14. createdAt: Joi.string(),
  15. _id: Joi.string(),
  16. lastUpdatedAt: Joi.string(),
  17. type: Joi.string(),
  18. /** our fields */
  19. email: Joi.string().email({
  20. minDomainSegments: 2,
  21. tlds: { allow: ['com', 'net'] },
  22. }),
  23. /** fields that should match backend service*/
  24. user_name: Joi.string(),
  25. user_id: Joi.number(),
  26. user_email: Joi.string(),
  27. profile_id: Joi.number(),
  28. profile_description: Joi.string(),
  29. profile_media: Joi.array().items(Joi.string()),
  30. profile_languages: Joi.array().items(Joi.string()),
  31. profile_prefs: Joi.object(),
  32. responses: Joi.array().items(responseSchema), // response entity schema goes here
  33. reveal: Joi.array().items(),
  34. tags: Joi.array().items(),
  35. user_type: Joi.string(),
  36. /** tricky module system fields */
  37. ...allModules.location({
  38. street: Joi.string(),
  39. apt: Joi.string(),
  40. city: Joi.string(),
  41. state: Joi.string(),
  42. zip: Joi.number(),
  43. }),
  44. }),
  45. /** fields required before saving */
  46. required: [],
  47. validate(instance) {
  48. return this.properties.validate(instance)
  49. },
  50. }
  51. export { profileSchema }