'use strict'; const Joi = require('joi'); const pluginConfig = { handlerType: 'grouping', docs: { description: 'leave', notes: 'Leave a grouping by creating a membership record' } } const validators = { leave: { payload: Joi.object() } } module.exports = { method: 'POST', path: '/leave', options: { ...pluginConfig.docs, tags: ['api'], auth: false, handler: async function (request, h) { try { return { ok: true, handler: pluginConfig.handlerType, data: { foo: 'bar' } } } catch(err) { return { ok: false, handler: pluginConfig.handlerType, data: { error: `${err}` }, } } }, validate: validators.leave, response: { schema: Joi.object({ ok: Joi.bool(), handler: Joi.string(), data: validators.leave }), failAction: 'log' } } }