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

patch-queue.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. 'use strict'
  2. const Joi = require('joi')
  3. const pluginConfig = {
  4. handlerType: 'profile',
  5. docs: {
  6. description: 'Updates match queue in place',
  7. notes: 'Updates in place and does not delete from table',
  8. },
  9. }
  10. const validators = {
  11. params: Joi.object({ profile_id: Joi.number(), target_id: Joi.number() }),
  12. query: Joi.object({ reinsert: Joi.boolean() }),
  13. }
  14. module.exports = {
  15. method: 'PATCH',
  16. path: '/{profile_id}/queue/{target_id}/delete',
  17. options: {
  18. ...pluginConfig.docs,
  19. tags: ['api'],
  20. /** Protect this route with authentication? */
  21. auth: false,
  22. handler: async function (request, h) {
  23. const { profile_id, target_id } = request.params
  24. const { reinsert } = request.query
  25. const { matchQueueService } = request.server.services()
  26. return await matchQueueService.markAsDeleted(
  27. profile_id,
  28. target_id,
  29. reinsert,
  30. )
  31. },
  32. /** Validate based on validators object */
  33. validate: {
  34. ...validators,
  35. failAction: 'log',
  36. },
  37. // couldn't get validate server response working...
  38. /** Validate the server response */
  39. // response: {
  40. // schema: Joi.object({
  41. // ok: Joi.bool(),
  42. // handler: Joi.string(),
  43. // data: Joi.object(),
  44. // }),
  45. // },
  46. },
  47. }