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

queue.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 'use strict'
  2. const Joi = require('joi')
  3. const pluginConfig = {
  4. handlerType: 'profile',
  5. docs: {
  6. description: 'Returns previously scored profiles',
  7. notes: 'returns from the MatchQueue Table',
  8. },
  9. }
  10. const validators = {
  11. params: Joi.object({ profile_id: Joi.number() }),
  12. }
  13. module.exports = {
  14. method: 'GET',
  15. path: '/{profile_id}/queue',
  16. options: {
  17. ...pluginConfig.docs,
  18. tags: ['api'],
  19. /** Protect this route with authentication? */
  20. auth: false,
  21. handler: async function (request, h) {
  22. const { profile_id } = request.params
  23. const { matchQueueService } = request.server.services()
  24. return await matchQueueService.getPotentials(profile_id)
  25. },
  26. /** Validate based on validators object */
  27. validate: {
  28. ...validators,
  29. failAction: 'log',
  30. },
  31. // couldn't get validate server response working...
  32. /** Validate the server response */
  33. // response: {
  34. // schema: Joi.object({
  35. // ok: Joi.bool(),
  36. // handler: Joi.string(),
  37. // data: Joi.object(),
  38. // }),
  39. // },
  40. },
  41. }