'use strict' const Joi = require('joi') const pluginConfig = { handlerType: 'profile', docs: { description: 'Updates match queue in place', notes: 'Updates in place and does not delete from table', }, } const validators = { params: Joi.object({ profile_id: Joi.number(), target_id: Joi.number() }), query: Joi.object({ reinsert: Joi.boolean() }), } module.exports = { method: 'PATCH', path: '/{profile_id}/queue/{target_id}/delete', options: { ...pluginConfig.docs, tags: ['api'], /** Protect this route with authentication? */ auth: false, handler: async function (request, h) { const { profile_id, target_id } = request.params const { reinsert } = request.query const { matchQueueService } = request.server.services() return await matchQueueService.markAsDeleted( profile_id, target_id, reinsert, ) }, /** Validate based on validators object */ validate: { ...validators, failAction: 'log', }, // couldn't get validate server response working... /** Validate the server response */ // response: { // schema: Joi.object({ // ok: Joi.bool(), // handler: Joi.string(), // data: Joi.object(), // }), // }, }, }