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.

match-queues.js 994B

1234567891011121314151617181920212223242526272829303132333435363738
  1. const Joi = require('joi')
  2. /**
  3. * Match Queue
  4. * A match queue record stores prematched target-profiles
  5. * to display *in order* for the logged-in profile.
  6. *
  7. * example:
  8. * { profile_id: 2, target_id: 54 }
  9. * { profile_id: 2, target_id: 27 }
  10. * { profile_id: 2, target_id: 83 }
  11. *
  12. * This example will display profiles 54, 27, 83 to
  13. * profile 2 when they login.
  14. */
  15. // validator is used to validate route input/output
  16. const validator = Joi.object({
  17. match_queue_id: Joi.number(),
  18. profile_id: Joi.number().required(),
  19. target_id: Joi.number().required(),
  20. }).label('queue__single_validator')
  21. const list = Joi.array().items(validator).label('queue__list_validator')
  22. // single is used to define database models
  23. const single = Joi.object({
  24. match_queue_id: Joi.number(),
  25. profile_id: Joi.number().required(),
  26. target_id: Joi.number().required(),
  27. _is_deleted: Joi.boolean().required(),
  28. }).label('queue__single')
  29. module.exports = {
  30. single,
  31. validator,
  32. list,
  33. }