選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

profile.js 935B

1234567891011121314151617181920212223242526272829303132333435
  1. const Joi = require('joi')
  2. const responseSchema = require('./responses')
  3. const userSchema = require('./users')
  4. const associationSchema = require('./tag-associations')
  5. /**
  6. * Profiles
  7. * A profile links a human user to multiple
  8. * job seeking or job posting profiles.
  9. */
  10. // validator is used to validate route input/output
  11. const validator = Joi.object({
  12. profile_id: Joi.number(),
  13. user: userSchema.single,
  14. responses: responseSchema.list,
  15. reveal: Joi.array().items(),
  16. tags: associationSchema.list,
  17. profile_description: Joi.string().allow(null, ''),
  18. }).label('profile__single_validator')
  19. const list = Joi.array().items(validator).label('profile__list_validator')
  20. // single is used to define database models
  21. const single = Joi.object({
  22. profile_id: Joi.number(),
  23. user_id: Joi.number(),
  24. _is_deleted: Joi.number(),
  25. }).label('profile__single')
  26. module.exports = {
  27. single,
  28. validator,
  29. list,
  30. }